How to make plugins process Section/Category descriptions (for Joomla 1.0.x)?
Written by kksou   
Tuesday, 22 April 2008

In standard Joomla 1.0.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 works for Joomla 1.0.x only. For Joomla 1.5.x, please refer to How to make plugins process Section/Category descriptions (for Joomla 1.5.x)?.


Solutions

You need to add two triggers to make Section/Category descriptions processed by your existing plugins that currently work with content items.

Add Trigger #1

  1. Go to the folder <Joomla root folder>/components/com_content, you will see a file called content.html.php.
  2. Open this file content.html.php in your favorite editor.
  3. Go to around Line 28. In the function showContentList(), add the five lines highlighted in yellow to the start of the function as follows:
  4. class HTML_content {
        /**
        * Draws a Content List
        * Used by Content Category & Content Section
        */
        function showContentList( $title, &$items, &$access, $id=0, $sectionid=NULL, 
            $gid, &$params, &$pageNav, $other_categories, &$lists, $order, 
            $categories_exist ) {
    
            $title->text = $title->description;
            global $_MAMBOTS;
            $_MAMBOTS->loadBotGroup( 'content' );
            $results = $_MAMBOTS->trigger( 'onPrepareContent', array( 1, &$title, &$params) );
            $title->description = $title->text;
    
            global $Itemid, $mosConfig_live_site;
    
            if ( $sectionid ) {
                $id = $sectionid;
            }
    
  5. Save and close this file.

Add Trigger #2

  1. Go to the folder <Joomla root folder>/components/com_content, you will see a file called content.php.
  2. Open this file content.php in your favorite editor.
  3. Go to around Line 1227. In the function BlogOutput(), add the five lines highlighted in yellow to the start of the function as follows:
  4. // Secrion/Category Description & Image
    if ( $menu && $menu->componentid && ( $descrip || $descrip_image ) ) {
    	$link = $mosConfig_live_site .'/images/stories/'. 
    	$description->image;
    	echo '<tr>';
    	echo '<td valign="top">';
    	if ( $descrip_image && $description->image ) {
    		echo '<img src="'. $link .'" align="'. $description->image_position .
    		'" hspace="6" alt="" />';
    	}
    	if ( $descrip && $description->description ) {
    
    		$description->text = $description->description;
    		global $_MAMBOTS;
    		$_MAMBOTS->loadBotGroup( 'content' );
    		$results = $_MAMBOTS->trigger( 'onPrepareContent',
    		    array( 1, &$description, &$params) );
    		$description->description = $description->text;
    
    		echo $description->description;
    	}
    	echo '<br/><br/>';
    	echo '</td>';
    	echo '</tr>';
    }
    
    // Leading story output
    if ( $leading ) {
    	echo '<tr>';
    	echo '<td valign="top">';
    
  5. Save and close this file.

That's it. You can try {mosloadposition}. 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

  • Bear in mind that this solution will mean that ALL plugins that work on your content items will also work on section/category descriptions. So make sure you double check that the section/category descriptions look ok.
  • In the event that you do not want a plugin to work on a section/category description, you might need to modify the plugin to bypass the processing.


User reviews

There are no user reviews yet.

Note: You have to be a registered member to leave a comment. Free registration here.

 
< Prev   Next >

Blog - Forum - Privacy Policy - Contact Us
Copyright © 2006-2009. kksou.com. All Rights Reserved