simple fix for Joomla rss (com_ninjarssyndicator) blank line issue.

Like many we experienced the blank line issue within the Joomla RSS ninja syndicator. The effect of this blank line is that it is not being recognized by rss parsers. To overcome this little issue without needing to hack all the joomla plugin source files in search of this blank line i simply wrote a little PHP script that removes this first line if its there, else it will simply output the rss.

I used this broken company training feedĀ  and fixed it using php. You can view them here.

http://www.amis.nl/index.php?option=com_ninjarsssyndicator&feed_id=7&format=raw

http://technology.amis.nl/blog/xmlfeed.php?id=1

The script to fix it is shown below. Simply alter the urls and paste it inside a php file somewhere on your webserver.

<?php
///////
// Very simple script to clean the blankline from out RSS FEED.
$default = 2; // Default feed id.

if(isset($_GET{'id'})){
   if(is_numeric($_GET{'id'})){
      $index = $_GET{'id'};
   }else{
      $index = $default;
   }
}else{
   $index = $default;
}

$url = 'http://www.amis.nl?option=com_ninjarsssyndicator&feed_id='.$index.'&format=raw';

if($lines = file($url)){
   foreach($lines as $n => $l){
     if(ord($l) != '10'){
       echo "$l";
     }
   }
}
exit;
?>

Advertisement

About Chris Gralike

I have been in the IT business for about 10 Years now. Started as an inexperienced systems engineer, and 10 years later.... all that changed is the title, but still inexperienced... I believe that there is only one lesson to be learned in the IT which is, there is no thing like 'experienced' in IT, and you should always expect new, challenging, inspiring and unexpected things. Your value in IT can only be measured by the ability to adopt. I maintain a blog on which I publish this Gravatar knowingly. In all other cases find me at the following locations : LINKEDIN : http://www.linkedin.com/in/chrisgralike TWITTER : http://twitter.com/#!/chris_gralike WORDPRESS : http://sysengineers.wordpress.com/ With kind regards, Chris Gralike.

Posted on September 15, 2011, in PHP and tagged , , , , , , , , , , . Bookmark the permalink. 2 Comments.

  1. Hi,

    Which PHP file do you recommend that we paste the above code to?

  2. Hi itoctopus,

    Simply create a new file in the root directory. Just make sure you dont overwrite any of the existing files.

    I have updated to code to make it more secure still and more usable.

    Rgrds, Chris

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.