Размер файла: 5.78Kb
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>CaféRSS ReadMe</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<h1>CaféRSS (1.0)</h1>
<p>CaféRSS is a simple RSS aggregator that's quite easy to integrate
into your pages.<br />
It supports RSS 0.9, 0.91, and 0.92 feeds (and RSS 0.93 shall work in a later
version).<br />
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.
</p>
<h2>Usage</h2>
<p>include('cafeRSS.php');<br />
$rss = new cafeRSS();<br />
$rss->display('http://example.com/rssfeed.xml');<br />
</p>
<p>This is the most simple way to use it. The <i>display</i> function makes
the script render an RSS feed from an URL or a string if you pass it a string.<br />
</p>
<p>To set an option, use the <i>assign </i>function.<br />
</p>
<p>$rss->assign('items', 5); // would display only up to 5 items<br />
</p>
<p>Here are the options you can set:</p>
<ul>
<li><b>items </b>: number, or 'all' (default is 'all')</li>
<li><b>template_string </b>: string that defines the template (default is an empty string, so CaféRSS would use the template file)</li>
<li><b>template_file</b>: URL or path to a template (default is 'cafeRSS_template.txt')</li>
<li><b>use_cache </b>: 0, 1 for OFF/ON (default is 0)</li>
<li><b>cache_dir </b>: path to a directory where the cached RSS feeds will reside; directory needs to be CHMOD 777 (default is 'cafeRSS_cache')</li>
<li><b>refresh_time </b>: number of seconds after which a cached feed is expired (default is 900, which is 15 minutes)</li>
<li><b>echo </b>: 0, 1 for OFF/ON, states whether it will echo the rendering or not, in the latter case it would return the rendering as a string (default is 1)</li>
<li><b>debug </b>: 0, 1 for OFF/ON, outputs some debug info (default is 0)</li>
</ul>
<p>Hint: caching is strongly advised ;)<br />
For example, if you want to display only 5 items and cache the RSS feed in
a directory named 'mycache', here goes:</p>
<p>
$rss = new cafeRSS();<br />
$rss->assign('items', 5);<br />
$rss->assign('use_cache', 1);<br />
$rss->assign('cache_dir', 'mycache');<br />
$rss->display('http://example.com/rssfeed.xml');
</p>
<p>You can also make use $rss->display('somelocalrssfile.xml'); to use a
local RSS file instead of a remote one.<br />
<br />
Check example.php for a simple example of using this script.</p>
<p> </p>
<h2>Template</h2>
<p>You can modify the template used to render the RSS feed, and/or create
new templates.<br />
</p>
<p>There are 2 template tags, and 14 template variables.<br />
Template tags start like this: {tag}, and end like this: {/tag}. Template
variables are like this: {$variable}.<br />
</p>
Tags:<br />
<ul>
<li><b>{rss_image}</b> if there is an image in the feed (using the <image> section), the section between the {rss_image} and {/rss_image} tags will be displayed; if there is no <image>, the section will be ignored.</li>
<li><b>{rss_items}</b> defines a loop to display all the RSS <item> tags and their contents.</li>
</ul>
<p>Variables that go in the {rss_image} (<image>) section:</p>
<ul>
<li><b>{$rss_image_url}</b> displays the content of the <url> tag</li>
<li><b>{$rss_image_title}</b> displays the content of the <title> tag</li>
<li><b>{$rss_image_link}</b> displays the content of the <link> tag</li>
</ul>
<p>Variables that go in the {rss_items} section:</p>
<ul>
<li><b>{$rss_item_title}</b> displays the content of the <title> tag</li>
<li><b>{$rss_item_link}</b> displays the content of the <link> tag</li>
<li><b>{$rss_item_description}</b> displays the content of the <description> tag</li>
</ul>
Variables that go outside of these sections (the headers of the RSS feed)
:<br />
<ul>
<li><b>{$rss_title</b><b>}</b> displays the content of the <title> tag</li>
<li><b>{$rss_link</b><b>}</b> displays the content of the <link> tag</li>
<li><b>{$rss_description</b><b>}</b> displays the content of the <description> tag</li>
<li><b>{$rss_lastBuildDate</b><b>}</b> displays the content of the <lastBuildDate> tag</li>
<li><b>{$rss_docs</b><b>}</b> displays the content of the <docs> tag</li>
<li><b>{$rss_managingEditor</b><b>}</b> displays the content of the <managingEditor> tag</li>
<li><b>{$rss_webMaster</b><b>}</b> displays the content of the <webMaster> tag</li>
<li><b>{$rss_language</b><b>}</b> displays the content of the <language> tag</li>
</ul>
<p>You can check the default template file cafeRSS_template.txt for a simple
example of a template.</p>
<p> </p>
<h2>Notes</h2>
<p>If you don't use the use_cache option, don't complain the script takes
long to fetch the files :P<br />
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.<br />
You can also use this class several times in the same script and/or change
its options around, for different feeds' URLs and templates.<br />
If you have any comment or suggestion, or want to tell me you got CaféRSS up on your website, email me: <a href="mailto:m@tidakada.com?subject=CaféRSS">m at tidakada.com</a></p>
<p>CaféRSS is ©2002 Michel Valdrighi - <a href="mailto:m@tidakada.com?subject=CaféRSS">m at tidakada.com</a>
- <a href="http://tidakada.com" target="_blank" title="my weblog">http://tidakada.com</a><br />
CaféRSS is released under the GPL (see license.txt)<br />
You can download a new version on <a href="http://tidakada.com/cafeRSS/" title="CaféRSS homepage">http://tidakada.com/cafeRSS/</a></p>
<p>Have fun !<br />
</p>
</body>
</html>