If you’re thinking about adding syndication to your website, consider using SimplePie, a super fast and easy-to-use feed parser written in PHP. With SimplePie, adding a RSS feed to your site couldn’t be more easier. In this article, I will show you how to create a RSS page that will display a feed. It will display my blog’s RSS feed as default when nothing is clicked. I’ve included a couple of links that are clickable. When the links are clicked, the RSS feed for that link will be displayed.
First, download SimplePie.
Next, we need to create a file and copy the code below. The code is pretty much self-explanatory.
set_feed_url($_GET[feed]);
// Run SimplePie.
$feed->init();
// Send the result to show up on the browser
$feed->handle_content_type();
?>
Yahoo News |
Reuter News
get_title(); ?>
get_description(); ?>
get_items() as $item): ?>
See the demo. Just add your own CSS stylesheet and you're ready to go.