, Guest!
Already a Member? Login or Register.

Menu



Showcase


Due to the volume of spam happening on our forums, posting is now restricted to verified members only.  If you're not verified, drop us a note with your username.

Home > FlexCMS Support Forum > User Help > Code Snippets > RSS Feed

FlexCMS Support Forum


RSS Feed
Started July 10, 2005 @ 5:40pm by Daniel
Post Message 
Daniel


Posts: 2
 
RSS FeedJuly 10, 2005 @ 5:40pm
How can I add an RSS feed to either a block or a page? I have tried with Javascript and PHP code snippets and receive errors.
 
otter
Administrator



Posts: 177
 
July 10, 2005 @ 5:59pm
Hi Daniel,

Sorry you are having problems with your RSS feed.

Here's a snippet of code you can use to bring in RSS feeds to your FlexCMS site. Just modify the output to suit your needs.

1. Create a new page and/or block

2. Insert the following code into the contents area:


Code

$newsfeed = 'http://rss.news.yahoo.com/rss/security';

$fp = @fopen($newsfeed, 'r');
while(!feof($fp)){
$row .= @fgets($fp, 4096);
}
@fclose($fp);

if( eregi('<item>(.*)</item>', $row, $rowitem ) ) {
$item = explode('<item>', $rowitem[0]);

for( $i = 0; $i < count($item) - 1; $i++ ) {

eregi('<title>(.*)</title>', $item[$i+1], $title );
eregi('<link>(.*)</link>', $item[$i+1], $url );
eregi('<description>(.*)</description>', $item[$i+1], $categorie);

echo '<a href="' . $url[1] . '" target="_blank">' . $title[1] . '</a><br>' . $categorie[1] . '<br><br>';

}
}


NOTE: Replace the $newsfeed URL with the URL of the newsfeed you wish to display in your block or page.

3. Check the Process PHP Code? box and save your block/page.

You can see this exact code up and running here.

If you have any other questions or problems, let us know.

Thanks!

Otter


ONLINE TRAINING CLASSES FOR FLEXCMS IN MAY: FlexCMS Basics (101), Sat., May, 15, 2010 & FlexCMS Blocks (Mon., May 10, 2010).
 

Last Edit: July 10, 2005 @ 6:00pm by otter
Daniel


Posts: 2
 
July 10, 2005 @ 6:05pm
Thanks so much, it worked great. I'm not sure what I was doing wrong.
 
otter
Administrator



Posts: 177
 
July 10, 2005 @ 6:08pm
No problem! Glad you got it up and running!

Otter


ONLINE TRAINING CLASSES FOR FLEXCMS IN MAY: FlexCMS Basics (101), Sat., May, 15, 2010 & FlexCMS Blocks (Mon., May 10, 2010).
 

Post Message 




Try & Buy FeedForAll - Easy to use RSS Feed Creator - great for iTunes users!

MEMBERS




All Contents, Code, Scripts and Technologies Copyright 2003-2009 FlexCMS.
All Rights Reserved. Software License Agreement

Processing Time: 0.16846 seconds.
 
Management Login

Powered By FlexCMS
Powered By FlexCMS