|
 |
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 |
|
|
RSS Feed | July 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 | |
|
|
|
| |
|
|
| 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). |
|
|
|
|
|
|
|


|
|
 | MEMBERS 
|

|
|