plugin: Hide include_content_item in RSS Feed
Written by kksou   
Tuesday, 20 May 2008

This plugin hides {include_content_item} tags in your RSS feed.

If you have installed the {include_content_item} plugin, and you're also using the standard RSS feed generator that comes installed with Joomla 1.0 and 1.5, you will find that those {include_content_item} tags will appear in the RSS feed too! This is usually undesirable.

This plugin will automatically hide all these {include_content_item} tags so that the RSS feed is FREE of these {include_content_item} tags.


Latest Version

v1.0.2 (for Joomla 1.0) and v1.5.2 (for Joomla 1.5)
Released December 9, 2008

  • fixed the warning message "Undefined variable: flag"
  • added hiding for the tags include_content_item, include_intro, and include_fulltext

Download


How to install (Joomla 1.0.x)

  1. Download the plugin and unzip it into a folder.
  2. From the Installers menu, select mambots. In the field "Install directory", enter the folder location (where you unzipped the file) and click Install.
  3. From the Mambots menu, select Site Mambots.
  4. Make sure the plugin "Hide include_content_item in RSS Feed" is published. If you see a cross in the Published column, just click on it. It will turn into a green tick.
  5. To use this plugin, you need to add a trigger to the RSS feed generator. In the original Joomla installation, there is no trigger during the generation of RSS feed. When there is no trigger, none of the plugin gets called. In order for Joomla to call the new plugin that we have just installed to hide the DirectPHP commands, we need to add a trigger.
  6. Note: If you've already installed the plugin "Hide DirectPHP for RSS Feed", "Hide include_content_item in RSS Feed" or "Hide jumi for RSS Feed" you can skip this step. The same trigger will trigger all these plugins.

    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, and add the three lines highlighted in yellow as follows:
    4. $database->setQuery( $query, 0, $info[ 'count' ] );
      $rows = $database->loadObjectList();
      
      global $_MAMBOTS;
      $_MAMBOTS->loadBotGroup( 'content' );
      
      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 );
      
      	$results = $_MAMBOTS->trigger( 'onBeforeDisplayTitle', 
      	    array( &$row, array(), 16) ); 
      
      	// 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 );
      
    5. Save and close this file.

  7. For 1.0.x, there's one more "bug" that we need to fix. The bug will prevent the RSS feed generator from generating the rss file properly when triggering the plugins. Go to the folder <Joomla root folder>/mambots/content. You will see a file called mossef.php. Open this file in your favorite editor. Scroll all the way to the last line. You will find that there an additional tab character after ?>. The tab character is invisible. But if you move the cursor, you will know that it's a tab. Just delete that tab character and save it.
  8. That's it! But before we generate the rss file, let us erase any previous cached version of the rss file. Go to the folder <Joomla root folder>/cache. Delete all the rss*.xml files there.
  9. Try generate a fresh copy of your RSS feed. It should now be clean of any {include_content_item} tags!

How to install (Joomla 1.5.x)

  1. Download the plugin and unzip it into a folder.
  2. From the Extensions menu, select Install/Uninstall. In the field "Install directory", enter the folder location (where you unzipped the file) and click Install.
  3. From the Extensions menu, select Plugin Manager.
  4. Enable the plugin "Hide include_content_item in RSS Feed" - make sure there is a green tick in the Enabled column.
  5. To use this plugin, you need to add a trigger to the RSS feed generator. In the original Joomla installation, there is no trigger during the generation of RSS feed. When there is no trigger, none of the plugin gets called. In order for Joomla to call the new plugin that we have just installed to hide the DirectPHP commands, we need to add a trigger.
  6. Note: If you've already installed the plugin "Hide DirectPHP for RSS Feed", "Hide include_content_item in RSS Feed" or "Hide jumi for RSS Feed" you can skip this step. The same trigger will trigger all these plugins.

    1. Go to the folder <Joomla root folder>/libraries/joomla/document/feed/renderer, you will see a file called rss.php.
    2. Open this file rss.php in your favorite editor.
    3. Go to around Line 110, and add the three lines highlighted in yellow as shown below:
    4. 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++)
      {
      	$results=$dispatcher->trigger('onBeforeDisplayTitle',
      	    array(&$data->items[$i], array(), 16));
      
      	$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";
      	}
      

    5. Save and close this file.

  7. That's it! But before we generate the rss file, let us erase any previous cached version of the rss file. Go to the folder <Joomla root folder>/cache. Delete the file rss_com_content.xml.
  8. Try generate a fresh copy of your RSS feed. It should now be clean of any {include_content_item} tags!


User reviews   Average user ratings:    4.0   (from 3 users)
  1. Erwin van den Boogaard
    September 03, 2008 3:01pm
    3rd party RSS feeders?

    Do you have a solution for 3rd party RSS feeders like iJoomla's RSS Feeder?

  2. kksou
    September 04, 2008 2:58am

    I took a look at iJoomla's RSS Feeder's site. It's a commercial software for $59.95.

    Since you've paid for the software, you should ask them to add the code for you.

    As you can see above, you only need to add a couple of lines to trigger the plugin. The 'trick' is to know where to add the code. Since they wrote the software, they will know where to add it.

    Regards,
    /kksou

  3. Bartosz
    November 17, 2008 8:57am
    It doesn't work for me

    Hello, I have both Hide DirectPHP for RSS Feed and Hide include_content_item in RSS Feed instaled and enabled and still have
    {include_intro }
    {include_fulltext } in published rss. In Joomla 1.0 there wasn't such a problem. I use standard mod_syndicate to publish it.
    Regards
    Bartek

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