In the previous article we discussed how to read an RSS file with PHP. In this article we will focus on the theoretical aspects of how to build an RSS file.
<item> <title>The title of the story here</title> <link>the link to the story here</link> <description>The description here </description> </item> </channel> </rss>
The section in bold is the only difference between a simple version and a enhanced version. The enhanced version makes more information about the creator of the RSS document available to the RSS reader and aggregators. None of this really matters as far as an RSS reader is concerned, as long as the required elements are included.
Take a careful look at the image tag. It has three required tags: title, link and url, and two optional tags: width and height. Table 3 below explains how these tags are used and what they are for.
Table 3:
Element
Description
Example
title
describes the image; it's used in the ALT attribute of the HTML <img> tag when the channel is rendered in HTML.
RSS Tutorial
link
is the URL of the site; when the channel is rendered, the image is a link to the site. (Note, in practice the image <title> and <link> should have the same value as the channel's <title> and <link>.
http://www.mysite.com/
url
is the URL of a GIF, JPEG or PNG image that represents the channel.
http://www.mysite.com/theimage.gif
width
Width of the image. Maximum value for width is 144, default value is 88.
44
Height
Height of the image. Maximum value for height is 400, default value is 31.