Creating An RSS 2.0 Feed
Reviewed by: Chiggins
Reviewed on: Jul 31 2008
Ok children. Today we are going to make our own RSS feed. RSS stands for Really Simple Syndication, and is used for constantly updated websites. Neoseeker uses RSS for their articles, as shows here.
First, make a file called "feed.rss" and save it to a place where you can remember. Now in the file, add these following lines of code:
<?xml version="1.0" encoding="utf-8"?> <rss version="2.0"> <channel> </channel> </rss>
That little piece of code says that it is a valid XML document, and is an RSS 2.0 Feed. Now we will add information about the feed itself. This code goes between the
<title>RSS Feed Title</title> <link>http://127.0.0.1//</link> <description>This is the description of the RSS Feed</description> <webMaster>email@example.com</webMaster> <managingEditor>firstname.lastname@example.org</managingEditor> <language>en-us</language> <lastBuildDate>Sun, 20 Jul 2008 18:48:25 -0500</lastBuildDate> <copyright>© 2008 Your Name Here</copyright>
Most of the tags are self explanatory. The lastBuildDate on needs to contain RFC 822 compliant time information. To do that in PHP, you would just do "date( "r" , time() )". And for the webMaster and managingEditor tags, ou wouldn't have down my email address.
Now we get to the good stuff. Each article will follow this "template".
<item> <title>Article Title</title> <link>Link To Article</link> <author>The Articles Author</author> <category>Category The Article Is In</category> <pubDate>Sun, 20 Jul 2008 18:48:25 -0500</pubDate> <description>Description Of The Article</description> </item>
For each article you have, you will need to add this template, and fill in the information. The pubData tag follows the same rules as the lastBuildDate, being RFC 822 compliant.
Now, the purpose of RSS feeds are to be dynamic, providing information to the client the moment it is published. Having to manually edit your feed file really isn't dynamic. So that is where a server side language will come into play. Using something like PHP, ASP, or ColdFusion to retrieve information from a database would be the perfect plan for the ability to make your feed more dynamic.
Well, here you learned how to give the clients to your website a way to view information in a faster more efficient way. RSS feeds are becoming quite populay, and would be a great addition to almost any site.