Chat with us, powered by LiveChat
Creating an RSS Feed

Creating an RSS Feed

RSS feeds are xml files updated on a regular basis which people subscribe to within RSS readers. The information carried on them is normally up to date and they are normally found on news sites and blogs, basically sites which are updated regularly and which people might like to be up to date with. In this article I will go through creating an RSS feed; they can be created in two forms: dynamic – this is where dynamic server side pages are created to query databases to display the new information automatically and require no manual intervention for the data to be displayed; manual – this is where a basic xml file is created and which has to be updated manually.

The Basic RSS Format

RSS feeds are made up of several different elements and tags which create the final document. The following is an example of an RSS feed:

As you can see the XML version used is the first thing to be declared within the document, the second being the beginning of the RSS tag which means the beginning of the feed; including both of these within your feed is important since a browser will use these to work out that it is an XML file which contains an RSS feed. Click here for an example of an RSS 2.0 feed.
The feed itself is contained within a ‘channel’ tag – some browsers output RSS feeds into a styled, readable format and this tag is important to ensure that browsers which have this capability are able to render your feed in this way. The first few lines within this tag describe your feed and contain information such as the title of the feed, a description of it, the language in which it is written as well as the last time it was updated.

After that the different items of the feed are shown – these are displayed within ‘item’ tags and there is no limit on the amount of these which you can have in one feed. The basics needed to structure an ‘item’ tag are the ‘title’ and ‘description’ tags which ensure that the item is outputted into a readable format.

Dynamic RSS Feeds

Feeds of this type require a server side page such as a PHP or ASP page be created to query a database so that the up to date information be displayed. This process requires no manual intervention and is completely automatic. To begin with you need to make sure that your page is outputted to the browser as an XML document, to do this you will need to add a header response line to the top of your page, and make sure that it outputs the page in the ‘text/xml’ format. The rest of the feed is outputted like the example above, except

Manual RSS Feeds

These feeds are ‘.xml’ files which are updated manually and always take the form of the feed displayed within the first section of this article. You should only opt for this type of feed if you aren’t going to update often as updating it can be a timely procedure.

Sharing

Leave your comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.