How to make plugins process Section/Category descriptions (for Joomla 1.5.x)? |
| Written by kksou | ||
| Monday, 28 April 2008 | ||
|
In standard Joomla 1.5.x installation, only the content items get processed by the mambots/plugins. This article shows you how to make the mambots/plugins process the Section/Category descriptions too. Note: the steps below are for Joomla 1.5.x. If you're using Joomla 1.0.x, please refer to How to make plugins process Section/Category descriptions (for Joomla 1.0.x)?. Solutions
class ContentViewCategory extends ContentView
{
function display($tpl = null)
{
global $mainframe, $option;
// Initialize some variables
$user =& JFactory::getUser();
$uri =& JFactory::getURI();
$document =& JFactory::getDocument();
$pathway =& $mainframe->getPathway();
$category =& $this->get('Category');
$dispatcher =& JDispatcher::getInstance();
JPluginHelper::importPlugin('content');
$category->text = $category->description;
$results = $dispatcher->trigger('onPrepareContent',
array (&$category, $category->params, 0));
$category->description = $category->text;
// Get the menu item object
$menus = &JSite::getMenu();
$menu = $menus->getActive();
class ContentViewSection extends ContentView
{
function display($tpl = null)
{
global $mainframe, $option;
// Initialize some variables
$user =& JFactory::getUser();
$document =& JFactory::getDocument();
$section =& $this->get('Section');
$dispatcher =& JDispatcher::getInstance();
JPluginHelper::importPlugin('content');
$section->text = $section->description;
$results = $dispatcher->trigger('onPrepareContent',
array (&$section, $section->params, 0));
$section->description = $section->text ;
// Get the page/component configuration
$params = &$mainframe->getParams();
// Request variables
$limit = JRequest::getVar('limit', $params->get('display_num'), '', 'int');
$limitstart = JRequest::getVar('limitstart', 0, '', 'int');
class ContentViewSection extends ContentView
{
function display($tpl = null)
{
.
.
.
//add alternate feed link
if($params->get('show_feed_link', 1) == 1)
{
$link = '&format=feed&limitstart=';
$attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
$document->addHeadLink(JRoute::_($link.'&type=rss'),
'alternate', 'rel', $attribs);
$attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
$document->addHeadLink(JRoute::_($link.'&type=atom'),
'alternate', 'rel', $attribs);
}
$dispatcher =& JDispatcher::getInstance();
JPluginHelper::importPlugin('content');
for($i = 0; $i < count($categories); $i++)
{
$category =& $categories[$i];
$category->link = JRoute::_('index.php?view=category&id='.
$category->slug);
$category->text = $category->description;
$results=$dispatcher->trigger('onPrepareContent',
array(&$category, $category->params, 0));
$category->description = $category->text ;
}
if ($total == 0) {
$params->set('show_categories', false);
}
That's it. You can try {loadposition}. It should now work even in Section/Category descriptions. You can also try DirectPHP plugin. You will now be able to include PHP commands in both the content items as well as Section/Category descriptions. Note
|
||
| Last Updated ( Tuesday, 29 April 2008 ) | ||
| < Prev | Next > |
|---|




