So what is Simplepie? It is a PHP script that you can install in your web host and configure it to get RSS feeds not only from other website and also from within your website. It also a good way to re-feed the various website and blogs that you have and stream them into one easy to access web page too.
For example if you have Twitter, Flickr, Blogger and your very own website, it would be difficult for your visitor (including yourself for that matter) to keep track of what's happening, so why not provide a single page where all your feeds are channelled into it?
So here comes Simplepie to the rescue! Head on over to the Simplepie.Org website and download the latest PHP script.
Upload the simplepie.inc file into your Webserver plus the various files as per their specification.
Then it is time to hack your web page. The file needs to be saved with a .php extension and your server must be able to handle PHP files.
Before the main HTML codes add these php lines
$feed = new SimplePie();
Then you need to tell it where to find the feed:
If you got several feeds, you have to use this line instead. Make sure you do not comma the last feed or you will get errors.
Init the feed with this line and ready for next step.
Somewhere in your main page add in the following PHP codes and you are good to go. Modify where necessary for the CSS to format the display.
foreach ($feed->get_items() as $item):
<h3><a href="<?php echo $item->get_permalink(); ?>" ><?php echo $item->get_title(); ?></a></h3>
<p><?php echo $item->get_description(); ?></p>
<p><small>Posted on <?php echo $item->get_date('j F Y | g:i a'); ?></small></p>
<?php endforeach; ?>
Easy, yes? That's why it is called Simplepie!
Post a Comment