Macrotone Blogs

Macrotone blogs upon Joomla, our products and other matters.
Font size: +

Problems writing a sh404sef installable plugin - resolved

I have been having problems getting a sh404sef installable plug-in working on Joomla 2.5.  Looking around the web, it seems that there do not appear to be any at all.  Of the sh404sef plug-ins available they nearly all require that the code is placed in a sef_ext directory under the component, OR placed in the sef_ext directory under the sh404sef component on the site (along with the supplied components).   This is not quite the same as having a separate installable plugin component.

 

The Anything Digital website has an article explaining how to write one, but no matter what I tried it would not work.  They helpfully provide a 'Developer' support forum, so I raised a question.  Not very helpfully they closed it with an instruction to raise the question in another forum.  A complete waste of time.  Reading around on the web, it seems I am not the only person to experience this type of response.

The instructions on the writing of the URL code worked well and this was soon completed, but the writing of the wrapper refused to work regardless what I changed.  Three small place lines of code and getting nowhere.

Eventually I dug deeper in the sh404sef code, a benefit of 'open source'.  I suspect that the format of the installable plug-in wrapper changed round about Joomla 1.7, and thus the example dated September 2011 is just plain wrong.

The solution appears to be that the directory in which the installable plug-in has to be placed has to be prefixed with the text 'sh404sefextplugin', along with the manifest and wrapper code.  I enclose the example of my manifest file below to illustrate it.  [I have called the component com_xxxxx, so you need to substitute the appropriate value for your own component.]

 



   sh404sef - Installable component support plugin
   Geoffrey S Chapman
   2012-04-06
   2012 Macrotone Consulting Ltd.
   http://www.gnu.org/copyleft/gpl.html GNU/GPL
   This email address is being protected from spambots. You need JavaScript enabled to view it.%3C" data-mce-href="mailto:This email address is being protected from spambots. You need JavaScript enabled to view it.%3C">This email address is being protected from spambots. You need JavaScript enabled to view it.<;;/authorEmail>
   www.macrotoneconsulting.co.uk
   1.0
   Provides default support for sef urls and meta data for the xxxxx component
  
      sh404sefextplugincom_xxxxx.php
      index.html
      xxxxx
  

 

 

The name of the manifest file also need the 'sh404sefextplugin prefix.  Installing the component creates a new directory sh404sefextplugincom_xxxxx under the sh404sefextplugins directory.

It was not a problem with my code at all, a problem with the naming of the wrapper and manifest file (and the directory that gets created.).

Now the installable plug-in works correctly.  I enclose the wrapper sample code as well for completeness.

 

?php
defined( '_JEXEC' ) or die( 'Direct Access to this location is not allowed.' );

class  Sh404sefExtpluginCom_xxxxx extends Sh404sefClassBaseextplugin {

  protected $_extName = 'com_xxxxx';

  public function __construct( $option, $config) {

    parent::__construct( $option, $config);
    $this->_pluginType = Sh404sefClassBaseextplugin::TYPE_SH404SEF_ROUTER;

  }

  protected function _findSefPluginPath( $nonSefVars = array()) {

    $this->_sefPluginPath =  JPATH_ROOT . DS. 'plugins'.DS.'sh404sefextplugins'.DS.'sh404sefextplugincom_xxxxx'.DS.'xxxxx'.DS.'com_xxxxx.php';

  }

}
?>

 

 

I hope that this is of use to any others trying to write a sh404sef installable component.  My thoughts upon the support provided by Anything Digital I shall keep to myself!

sh404sef plugin for Codingfish Discussions v1.5
Four steps to comply with PECR, ICO cookies regula...
 
Go To Top

Joomla! Debug Console

Session

Profile Information

Memory Usage

Database Queries