Extension:SimpleFeed

This extension outputs the contents of an RSS feed. It is very customisable. As a result, no editing of the PHP source is required as everything is done in the wiki page. The SimplePie extension PHP feed-parsing library is also required.

Installation

 * 1) Save SimpleFeed.php to extensions/ and make sure the server has permission to read it.
 * 2) Save simplepie.inc to extensions/.
 * 3) Create extensions/cache, set correct write permissions using chmod (www-user, or equivalent, should be allowed to write). Permissions are usually 755, 775 or 777. See setting permissions for cache directory
 * 4) ;NOTE:Earlier versions of SimpleFeed.php may require the cache folder to be created in $IP/cache</tt>, i.e. as a sibling, rather than subfolder of extensions</tt>. (This was required in the case of a combination of MediaWiki 1.10, simplepie</tt> 1.1, and a circa-2007 version of SimpleFeed</tt>.) The latest version available from the git repository appears to fix this problem, so an update is encouraged.
 * 5) Add include("./extensions/SimpleFeed.php");</tt> to the last line of LocalSettings.php</tt> before the end ?></tt>.

If you are in a corporate environment, check out any proxy servers or firewalls.

Usage
There are two arbitrary fields that must be present. These are the url</tt> argument, and the content between the  [...] </tt> tags. A simple example is shown below:

<feed url="http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml">

[{PERMALINK} {TITLE}]
{DATE}, by {AUTHOR} {DESCRIPTION}

This will pull the BBC News feed and output five posts. For every post, it will output the data between the feed</tt> tags, replacing {PERMALINK}</tt>, {TITLE}</tt>, {DATE}</tt>, {AUTHOR}</tt> and {DESCRIPTION}</tt> with the appropriate information.

Customisation
The following arguments can be used to customise the output:


 * url
 * The URL of the feed. This argument is not optional.


 * entries
 * The number of post entries to output. This defaults to 5, but can be any number. 0 is unlimited.


 * type
 * If this is set to "planet</tt>" then the post title and author will be retrieved from the title. For example, a post in a planet/aggregator could have a title "Joe Bloggs: MediaWiki is great". If <tt>type="planet"</tt> is set, then <tt>{TITLE}</tt> will become "Mediawiki is great", and <tt>{AUTHOR}</tt> will become "Joe Bloggs".


 * date
 * The format of the date to output. This conforms to PHP's date function syntax. This defaults to <tt>j F Y</tt> (E.g. 3 March 2007).

Further examples
Using an aggregator's feed <feed url="http://planet.debian.org/rss20.xml" type="planet">

[{PERMALINK} {TITLE}]
{DATE}, by {AUTHOR} {DESCRIPTION} This will remove the author's name from the title of the post, and setting its value to <tt>{AUTHOR}</tt>.

Changing the date format <feed url="http://planet.debian.org/rss20.xml" date="h:i:s d/m/y T">... Changes the date format to, in this example, "23:20:04 24/03/2007 GMT".

Parameters

 * Line 31: <tt>$simplepie_path</tt> - string: Path to <tt>simplepie.inc</tt>, including leading forward slash. For example:
 * $simplepie_path = 'extensions/';

Todo
The following feature(s) will be added shortly:
 * Check whether the URL given is a correct address. If SimplePie can't read it, output something.
 * Clean up the regular expressions.