Joomla 1.0 Articles
- How to create a module with DirectPHP plugin?
- How to include modules in Content item?
- How to include modules in Section/Content Description
- How to include PHP commands in Section/Content Description
- How to make plugins process Section/Category descriptions
- Include Code Listing plugin - More Tips and Techniques
- How to have DirectPHP plugin process RSS feed?
Joomla 1.5 Articles
- How to create a module with DirectPHP plugin?
- How to include modules in Content item?
- How to include modules in Section/Content Description
- How to include PHP commands in Section/Content Description
- How to make plugins process Section/Category descriptions
- Include Code Listing plugin - More Tips and Techniques
- How to have DirectPHP plugin process RSS feed?
|
How to have DirectPHP plugin process RSS feed (for Joomla 1.5.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.5 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.5.x. If you're using Joomla 1.0.x, please refer to How to have DirectPHP plugin process RSS feed (for Joomla 1.0.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. SolutionsAll you need is to add 5 lines to have DirectPHP plugin process the RSS feed!
if ($data->skipDays!="") {
$feed.= " <skipDays>".htmlspecialchars($data->skipDays,
ENT_COMPAT, 'UTF-8')."</skipDays>\n";
}
$dispatcher =& JDispatcher::getInstance();
JPluginHelper::importPlugin('content');
for ($i=0; $i<count($data->items); $i++)
{
$data->items[$i]->text = $data->items[$i]->description;
$results=$dispatcher->trigger('onPrepareContent',
array(&$data->items[$i], array(), 0));
$data->items[$i]->description = $data->items[$i]->text;
$feed.= " <item>\n";
$feed.= " <title>".
htmlspecialchars(strip_tags($data->items[$i]->title),
ENT_COMPAT, 'UTF-8')."</title>\n";
$feed.= " <link>".$url.$data->items[$i]->link."</link>\n";
$feed.= " <description><![CDATA[".
$this->_relToAbs($data->items[$i]->description)."]]></description>\n";
if ($data->items[$i]->author!="") {
$feed.= " <author>".htmlspecialchars(
$data->items[$i]->author, ENT_COMPAT, 'UTF-8')."</author>\n";
}
That's it! Now try your RSS feed. Your PHP commands should now be processed in the RSS feed too! NoteI wrote this solution for the DirectPHP plugin. But once you have added the 5 lines above, you should find that the RSS feed will get processed by ALL content 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 > |
|---|


