Hi all !
Today I’ve installed an RSS Reader Component in my cake application, so you can read the news at login time.
How ?
First, after searching cake community (bakery), I located this CakePHP RSS component
Following the instructions (very easy), you download the component into your vendors and components folder, then use it to get the feed, and display it as you like.
Tip: Cake has a funtion “truncate” inside the Text Helper to aid you if you like to get the first N characters for a headline or description of your feed.
Here is the code I’ve used
#CONTROLLER
var $helpers = array('Javascript','DAuth', 'Text');
var $components = array('DAuth','RequestHandler', 'Simplepie');
...... code ......
$items = $this->Simplepie->feed('http://blog.allmythingstodo.com/rss');
$this->set('feeds', $items);
#END OF CONTROLLER
#VIEW
<?php
foreach($feeds as $feed) {
echo $html->link($feed->get_title(), $feed->get_permalink()) . '<br/>';
echo $text->truncate($feed->get_description());
}
?>
#END OF VIEW
Thanks for the tips. This is the component I was looking for.
Comment by My-CakePHP — November 23, 2009 @ 7:42 pm
RSS Feeds are really very helpful and you could get site and news updates from it.`::
Comment by Xavier Watson — May 20, 2010 @ 6:29 pm
Thanks. This will be so helpful. Its easy to download.
Comment by Colorado Sports — July 2, 2010 @ 11:44 pm