CaRP: Caching RSS Parser - Documentation
"rss20": RSS 2.0 Theme
| Author: |
Antone Roundy |
| Filename: |
rss20.php |
| MyCarpConfReset name: |
n/a |
| Current version: |
1.0 |
Compatibility:
| GPL |
Koi |
Evolution |
| n/a |
n/a |
>=4.0 |
Description:
This theme configures CaRP to output in RSS 2.0 format, and provides an additional function to assist in the process.
IMPORTANT:
If you set the "outputformat" confirmation setting to 2
(to store CaRP's output in $carpoutput instead of displaying it),
you must copy $carpoutput immediately after calling RSS20Aggregate,
because subsequent calls to CarpCacheFilter and CarpAggregate will overwrite it,
not append to it.
Example:
The following code shows how you could make a "mashup" feed
using the feeds from Slashdot and Ars Technica using this plugin.
Important points to note:
- The code shown below is the entire contents of the file --
do not put any HTML code in the same file.
- If you wish to set "encodingout", it must be done before loading the theme.
With the possible exception of multi-byte language feeds, UTF-8 is the recommended encoding.
- The "RSS20Aggregate" function outputs the feed metadata.
It's arguments are the feed title, link, and description,
optionally followed by a timestamp (which must be a UNIX timestamp number).
- Be sure to call RSS20Aggregate before calling CarpCacheFilter.
- You may use CarpCacheFilter, CarpFilter, or CarpGroupFilter to prepare the input data.
- You may use CarpAggregate or CarpInterleave to output the feed items.
<?php
header('Content-Type: application/xml');
require_once '/path/to/carp/carp.php';
CarpConf('encodingout','UTF-8');
CarpLoadTheme('rss20.php');
RSS20Aggregate('My Feed','http://example.com/','I describe it thus');
CarpCacheFilter('http://rss.slashdot.org/Slashdot/slashdot','slashdot');
CarpCacheFilter('http://arstechnica.com/etc/rdf/ars.rdf','ars');
CarpAggregate('slashdot|ars');
?>