PHP Sample – RSS v1.0
August 16, 2008
There are basically three parts you need to be concerned about when generating an RSS v1.0:
- The RSS related data
- The feeds
- The search information
RSS related data
These will be the data that are specific to the whole feed or to the website. These would include the following:
- title
- link
- description
- image
Feed Items
These will be items you would want to put on the RSS Feed. Each Item would include the following:
- title of the article, news, or any other item depending on the use.
- description or summary
- link to the item page on your website
Search information (optional)
Some RSS readers supports search feature for RSS items. You could utilize this by setting up a search script on your host. This would need the following information:
- URL of the search script
- title
- description
- parameter name of the search string variable
See demo here (sample_rss_v1.0).
Attached is a simple template that could be used in any application. Like most of my sample template, all the data are hardcoded. They could easily be replaced with data coming from different sources like a database or a scraped html content.
Specified header might not be needed but the following could be used:
header("Content-Type: application/xml; charset=ISO-8859-1");
I’m Planning to post another using RSS v2.0.
Attachments:
Reference:
http://en.wikipedia.org/wiki/RSS_(file_format)#RSS_1.0
This is the first of many sample templates that I’ll be posting here. I usually just browse through the web to find templates / sample scripts for different web technologies but sometimes good articles disappear and could never be found. Most of the time clients will ask for added features like RSS feeds, integration to payment gateway, email form, etc. The problem is that is no script available to use that is easy enough to modify.
My plan here is to have a repository of simple scripts that could easily be copied and pasted to anywhere. I usually put the code part first and the template part next, so expect it on most of the sample scripts posted here.
Filed under: PHP, Samples |
Comments (0)
Related Links:

