GTD Tools – AllMyThingsTodo

March 20, 2008

CakePHP rss reader component installation

Filed under: cakephp — admin @ 1:23 pm

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

3 Comments »

  1. Thanks for the tips. This is the component I was looking for.

    Comment by My-CakePHP — November 23, 2009 @ 7:42 pm

  2. 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

  3. Thanks. This will be so helpful. Its easy to download.

    Comment by Colorado Sports — July 2, 2010 @ 11:44 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress