How to have RSS feed process DirectPHP and Include Content Item plugin (for Joomla 1.0.x)?
Written by kksou   
Monday, 12 May 2008

If you have used the DirectPHP plugin to include PHP commands in content articles, you will find that these PHP commands do not get processed in the RSS feed generator that comes standard with Joomla 1.0 installation.

This article shows you how to have DirectPHP plugin process the RSS feed so that users do not see all those PHP commands in the RSS feed.

Note: the steps below are for Joomla 1.0.x. If you're using Joomla 1.5.x, please refer to How to have DirectPHP plugin process RSS feed (for Joomla 1.5.x)?.


Explanations

In the original Joomla installation, there is no plugin trigger in the RSS feed generator. When there is no trigger, none of the plugin will get called.

In order for Joomla to have DirectPHP plugin process the RSS feed, we need to add a plugin trigger.

However, I originally tried to use the same approach as what I've used for Joomla 1.5. For some reason, it just doesn't work.

That's why you see a different approach being used for Joomla 1.0. As this method doesn't trigger all the content plugins, you will find that this method only calls the DirectPHP plugin. Your RSS feed will not be processed by any other plugins.

Solutions

All you need is to add 5 lines to have DirectPHP plugin process the RSS feed!

  1. Go to the folder <Joomla root folder>/components/com_rss, you will see a file called rss.php.
  2. Open this file rss.php in your favorite editor.
  3. Go to around Line 250, you should see the following lines:
    foreach ( $rows as $row ) {
    	// title for particular item
    	$item_title = htmlspecialchars( $row->title );
    	$item_title = html_entity_decode( $item_title );
    
    	// url link to article
    	// & used instead of & as this is converted by feed creator
    	$_Itemid	= '';
    	$itemid 	= $mainframe->getItemid( $row->id );
    	if ($itemid) {
    		$_Itemid = '&Itemid='. $itemid;
    	}
    
    	$item_link = 'index.php?option=com_content&task=view&id='. $row->id . $_Itemid;
    	$item_link = sefRelToAbs( $item_link );
    
    	// removes all formating from the intro text for the description text
    	$item_description = $row->introtext;
    	$item_description = mosHTML::cleanText( $item_description );
    	$item_description = html_entity_decode( $item_description );
    

  4. Now add the five lines highlighted in yellow as shown below:
  5. foreach ( $rows as $row ) {
    	// title for particular item
    	$item_title = htmlspecialchars( $row->title );
    	$item_title = html_entity_decode( $item_title );
    
    	// url link to article
    	// & used instead of & as this is converted by feed creator
    	$_Itemid	= '';
    	$itemid 	= $mainframe->getItemid( $row->id );
    	if ($itemid) {
    		$_Itemid = '&Itemid='. $itemid;
    	}
    
    	$item_link = 'index.php?option=com_content&task=view&id='. $row->id . $_Itemid;
    	$item_link = sefRelToAbs( $item_link );
    
    	global $_MAMBOTS, $mosConfig_absolute_path;
    	$row->text = $row->introtext;
    	require_once($mosConfig_absolute_path.'/mambots/content/DirectPHP.php');
    	botDirectPHP( 1, $row, $params);
    	$row->introtext = $row->text;
    
    	// removes all formating from the intro text for the description text
    	$item_description = $row->introtext;
    	$item_description = mosHTML::cleanText( $item_description );
    	$item_description = html_entity_decode( $item_description );
    

  6. Save and close this file.

That's it! Now try your RSS feed. Your PHP commands should now be processed in the RSS feed too!

Note

  • In the event that after adding these 5 lines, your RSS feed still shows the PHP commands, it might be because the Joomla is using the cached rss file. In this case, go to <Joomla root folder>/cache. You will see your rss files there e.g. rss20.xml. Delete this file so that a fresh rss feed will be generated.
  • As noted above, unlike the solution for Joomla 1.5, the solution for Joomla 1.0 will only work with DirectPHP. Your RSS feed will not be processed by any other plugins.


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