CaféRSS (1.0)

CaféRSS is a simple RSS aggregator that's quite easy to integrate into your pages.
It supports RSS 0.9, 0.91, and 0.92 feeds (and RSS 0.93 shall work in a later version).
To 'install' it, just upload everything on your server, and do CHMOD 777 on the cafeRSS_cache directory so that you can use the caching.

Usage

include('cafeRSS.php');
$rss = new cafeRSS();
$rss->display('http://example.com/rssfeed.xml');

This is the most simple way to use it. The display function makes the script render an RSS feed from an URL or a string if you pass it a string.

To set an option, use the assign function.

$rss->assign('items', 5); // would display only up to 5 items

Here are the options you can set:

Hint: caching is strongly advised ;)
For example, if you want to display only 5 items and cache the RSS feed in a directory named 'mycache', here goes:

$rss = new cafeRSS();
$rss->assign('items', 5);
$rss->assign('use_cache', 1);
$rss->assign('cache_dir', 'mycache');
$rss->display('http://example.com/rssfeed.xml');

You can also make use $rss->display('somelocalrssfile.xml'); to use a local RSS file instead of a remote one.

Check example.php for a simple example of using this script.

 

Template

You can modify the template used to render the RSS feed, and/or create new templates.

There are 2 template tags, and 14 template variables.
Template tags start like this: {tag}, and end like this: {/tag}. Template variables are like this: {$variable}.

Tags:

Variables that go in the {rss_image} (<image>) section:

Variables that go in the {rss_items} section:

Variables that go outside of these sections (the headers of the RSS feed) :

You can check the default template file cafeRSS_template.txt for a simple example of a template.

 

Notes

If you don't use the use_cache option, don't complain the script takes long to fetch the files :P
One good thing to optimise the time it takes, is to set a cronjob to fetch the RSS feed and then use the script to render the local copy of it, in which case you needn't use caching.
You can also use this class several times in the same script and/or change its options around, for different feeds' URLs and templates.
If you have any comment or suggestion, or want to tell me you got CaféRSS up on your website, email me: m at tidakada.com

CaféRSS is ©2002 Michel Valdrighi - m at tidakada.com - http://tidakada.com
CaféRSS is released under the GPL (see license.txt)
You can download a new version on http://tidakada.com/cafeRSS/

Have fun !