Thirteenth Parallel /archive/rss/
13th RSS 1.0 to anything (13r2a) version 1.0
A lot of the news feeds out on the web are still using RSS 0.91, they are not compatible with this script.
This page shows you how to use the PHP script.
The parser uses two template files that are specified in the query string, "maintemplate", which wraps the feed and displays information about the channel, and then "itemtemplate" which is used to format each of the individual items in the news feed.
To use the RSS variables in the template we use custom tags in the format:
<?13r2a tagname ?>
The tags that can appear in the main template are:
- feedTitle - main feed title specified in the "channel" tag
- feedLink - main link
- feedDescription - description of the feed
- imageURL - location of a thumbnail image for the feed
- imageTitle - title to go with the image
- imageDescription - (haven't really thought of a use for this one)
- imageLink - link for image (normally used if you click image)
- theFeed - where all the items are to go (from other template)
- numItems - how many items are the RSS file
- xmlFile - the raw XML file being used
The tags that can be used by the item template are:
- itemTitle - title of item
- itemDescription - the main description text for item
- itemLink - corresponding link
- itemNo - item's position in list (starts at 1)
So, in the main template you might have the line:
<h1><a href="<?13r2a feedLink ?>"> <?13r2a feedTitle ?></a></h1>
Note that the tags are case sensitive. More detailed template examples can be seen below.
[Future versions of this script will allow for custom tags or those from another RDF vocabulary, such as The Dublin Core, and also more complex template tags with attributes and logic.]
The script can cope with remote files for both the templates and the XML/RSS files. This means that you don't actually need to be able to run the PHP script to use it. The paths that are specified in the query string are relative to the PHP script. So, if you are running the script on your own server then "/templates/mymaintemplate.htm" is fine, however if you are using the script remotely (i.e. by linking to the script running on 13thparallel) then you need to specify the full URL in the query string, e.g. "http://www.mydomain.com/rss/templates/mymaintemplate.htm".
This example uses the two templates and the PHP script to create a standalone page. The main downside is that you will need to specify the full URL and query string and the 13r2a tags need to be placed in the main HTML file.
Here we use minimal template files and then a php include() to paste the parsed file into another document. This is generally more convenient method than creating a stand alone page. You could similarly use an SSI or an ASP include to reference the page.
Note the way the templates are specified in the query string.
This is the most flexible method if you can't run PHP scripts yourself. In the <script> tag's src attribute you can reference the PHP script running on our server. In the query string simply specify full paths to the XML file you want to display and your template files. e.g:
The example shown here simply displays the RSS fields, however with a bit of imagination there are some pretty dynamic ways you could use this facility.
Well, this is only version 1.0 of the script so bare with me, I'm sure there are a few bugs that need fixing and features that would be useful. If it turns out people are actually using this script then I'll continue development and make it better. There are also plans for an ASP version.
Syndication and news feeds aren't the only use for RSS. It can be a useful, standards-compliant tool for managing your own information. For example, an RSS file would be the perfect way to store descriptions of your photos.