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)?. ExplanationsIn 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. SolutionsAll you need is to add 5 lines to have DirectPHP plugin process the RSS feed!
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 );
That's it! Now try your RSS feed. Your PHP commands should now be processed in the RSS feed too! Note
|
||
| < Prev | Next > |
|---|




