^Status|Draft| ^Todo|Proof read| ====== Feed Helper ====== The Feed helper assist in the parsing of remote RSS feeds. ===== Methods ===== ==== parse() ==== ''parse($feed, $limit = 0)'' parses a remote feed and returns it as an array. * **[string]** ''$feed'' remote feed url, or local file path * **[int]** ''$limit'' maximum amount of items to parse -- default = 0 (infinite) * returns **[array]** parse feed. $feed = "feed.xml"; echo Kohana::debug(feed::parse($feed)); Use the code above on this RSS feed: Some feed item http://www.example.com/article34 This article is really cool! Aart-Jan Boor Sat, 08 Dec 2007 13:28:11 GMT Some feed item2 http://www.example.com/article546 This article is really cool too! Aart-Jan Boor Sat, 08 Dec 2007 12:57:56 GMT Some feed item3 http://www.example.com/article4523 This article is the best! Aart-Jan Boor Sat, 08 Dec 2007 12:39:42 GMT It will result in HTML as: Array ( [0] => Array ( [title] => Some feed item [link] => http://www.example.com/article34 [description] => This article is really cool! [author] => Aart-Jan Boor [pubDate] => Sat, 08 Dec 2007 13:28:11 GMT ) [1] => Array ( [title] => Some feed item2 [link] => http://www.example.com/article546 [description] => This article is really cool too! [author] => Aart-Jan Boor [pubDate] => Sat, 08 Dec 2007 12:57:56 GMT ) [2] => Array ( [title] => Some feed item3 [link] => http://www.example.com/article4523 [description] => This article is the best! [author] => Aart-Jan Boor [pubDate] => Sat, 08 Dec 2007 12:39:42 GMT ) ) ==== create() ==== ''create($info, $items, $format = 'rss2')'' creates an xml feed from a collection of items. * **[array]** ''$info'' feed information * **[array]** ''$items'' items to add to the feed * returns **[string]** generated feed. $info = array('notes' => 'Foo bar'); $items = array( array( 'title' => 'My very first feed created by KohanaPHP', 'link' => 'http://www.example.com/article/34', 'description' => 'This article is really nice!', 'author' => 'Flip van Rijn', 'pubDate' => 'Wed, 23 Sept 2009 17:13:25 GMT', ), ); echo feed::create($info, $items); That will result in this XML code: Foo bar Generated Feed http://localhost/ KohanaPHP My very first feed created by KohanaPHP http://www.example.com/article/34 This article is really nice! Flip van Rijn Wed, 23 Sept 2009 17:13:25 GMT