Cake PHP have launched a new version or their PHP framework and one of the snippets was the integration of SimplePie. The install and demo for normal sites is incredibly simple and the code is fully featured but held in a single file. It can even spit out the “subscribe via” links for the major sites.
All in all it appears to be very impressive.
- Unzip the files on your local file system and run the demo and make sure everything is setup ok. Don’t be alarmed by the huge logo, you are still on your own site 😉
- If you want to skip the demo the only file you actually need is simplepie.inc
- create this function in your script[php]function getSimplePie($url)
{
include(‘simplepie/simplepie.inc’);
// Parse it
$feed = new SimplePie();
$feed->feed_url($url);
$feed->cache_location(‘./../cache’);
$feed->init();if ($feed->data)
{
$output = “- Digitalpoint
- Favicon generator
- phpClasses.org
- R&OS PDF tool
- Wowexe.exe
9 Comments
Leave a Reply
[…] SimplePie […]
Where is the CakePHP SimplePie snippet? I just can’t find it.
Hi Geoffrey, I picked it up here: http://cakeforge.org/snippet/detail.php?type=snippet&id=53
Why the tables? 🙁
In the example? That’s just a hangover from the original test. I’d use a list normally.
How do i echo getsimplepie?
just
[php]echo getSimplePie(‘http://mysite.com/feed/’);[/php]
is there a way to include more than one rss feed?
No, but you can get several feeds – build them into an array, sort and output.