User Tools

Site Tools


Development of recaching JotCache plugins

Each JC plugin consists from three files (located in directory /plugins/jotcacheplugins/<plugin_name>) :

<plugin_name>.php        (plugin code)
<plugin_name>.xml        (plugin definition)
<plugin_name>_form.php   (plugin form)


PROCEDURES FOR PLUGIN DEVELOPERS

Plugin code

Plugin contains class as extension of JPlugin :

class plgJotcachepluginsRecache extends JPlugin

which implements method :

function onJotcacheRecache()


Plugin definition

have to be conform to standard Joomla 2.5 plugin XML definitions.

Take care for naming of plugin :

It is necessary to use same name in definition and plugin files. In definition of plugin title is used this name with leading capital character. In all other cases is used plugin name solely with lower case characters.

Plugin form

Plugin form is used as template form included to common Recache Control page (if plugin is enabled). It is part of JotCache component opened after click on Recache toolbar buton.

At code beginning use following definitions :

defined('_JEXEC') or die('Restricted access');
JHTML::_('behavior.tooltip');
$lang = JFactory::getLanguage();
$lang->load('plg_jotcacheplugins_<plugin_name>',
       JPATH_ADMINISTRATOR, null, false, false);

Form tag have to be conform to following code :

<form action="<?php echo JRoute::_('index.php?option=com_jotcache'); ?>"
 method="post" name="adminForm_<plugin_name>"
 id="adminForm_<Capital_leading_character_plugin_name>">
 
 Example :
 
 <form action="<?php echo JRoute::_('index.php?option=com_jotcache'); ?>"
  method="post" name="adminForm_recache" id="adminForm_Recache">

Plugin form shall contain hidden input tag with plugin recognition :

<input type="hidden" name="jotcacheplugin" value="<plugin_name>" />

Example :

<input type="hidden" name="jotcacheplugin" value="recache" />