Display Links to Latest Items of a RSS Feed
With a simple RSS parser you can very easily make a list to latest items of a RSS feed, server side with PHP.
The uses of this is great, especially if you manage several web sites. It is great for users to see directly new fresh links and it is great for SEO and ranking in Google to get links to your blog posts and other things created directly for fast indexing and ranking.
Example of RSS feeds
On a Wordpress blog there are not only an RSS feed of the blog as a whole but to every category and comments on all posts as well (feed URLs for Wordpress). This means that if you have a category about marketing and you have another web site about marketing you could display links on that site to your latest articles about marketing. Other web sites that have feeds: All blogs, newspapers, Delicious (including a unique feed for each of your tag), Twitter, Flickr, forums (vBulletin have a unique feed for each section of the forum as well), digg.com, link directories (phpLD has a feed for each category as well) and a whole lot more. See some live examples here.
The RSS Parser
A good but simple RSS parser (just 1 PHP file) which have caching and handles non-english characters is called LastRSS and was made by Vojtech Semecky.
I have revised it a bit to make it more simple and I also included the correction by Cory S.N. LaViska so that fopen() does not make a problem.
- Download the file.
- Make a new directory called cache and CHMOD it to 777.
- Edit the top of the file to change the URL of the feed and how many items to show.
- Optionally: change other settings at the near bottom of the file.
- Then simply add this at the place you want to list to appear:
<?php include("lastRSS.php"); ?>
This will only display the titles with links. If you want to show other things such as description you would need to change the code at near the bottom of the file.
If you want to show several different feeds on the same page you would need to have different files for each. You also need to edit the class name of LastRSS in the new files to for example lastRSS2, LastRSS3 and so forth. This is in line number 42 and 235.
See the official site of Last RSS for the original version and documentation.
Comments powered by Disqus
- Git with GitHub the Simple Way
- Annual report number 9 + 10: My Success
- Annual report number 8: My Success
- Guide: WordPress with Maximum Performance and Speed
- How to load WordPress in a few milliseconds using Redis
- Maximize the Link Juice of your Infographic with the use of the Canonical HTTP Header
- Why I recommend CloudFlare and why you should try it too
- Annual report number 7: My Success
- Sixth Annual Report: My Success
- Common CSS mistakes and their solutions