Sunday, February 11, 2007

Displaying RSS and Atom Feeds in MediaWiki

I used SimplePie to display Blogger atom feeds in Media Wiki (using the ancient 1.5.2 version). Here's an example:


http://www.chembiogrid.org/wiki/index.php/SimplePieFeedTest


To add another feed, all you need to do is edit a page and add this:

<:feed>:http://chembiogrid.blogspot.com/atom.xml</feed>

(Replacing chembiogrid's atom.xml with the alternative feed URL).


More info is here: http://simplepie.org/. It is as easy as advertised. See particularly here: http://simplepie.org/docs/plugins/mediawiki. Or just google "simplepie mediawiki".

Avoid Magpie RSS. I spent the whole afternoon trying to get it to work with Atom with no luck. SimplePie worked in about 5 minutes.

3 comments:

jay said...

Hi
I'm trying to get simple pie to post just the titles and the dates of blogger.com blog posts on a different page. Still working on it. Do you already have code that does this?
Jay

Marlon Pierce said...

I didn't do anything special to get it to work, just followed the instructions. You need to do two things:

1. Edit MediaWiki's LocalSettings.php to add the following near the bottom:
#
# Include the XFeeds reader for Magpierss.
#
include("extensions/XFeeds.php");
include("extensions/simplepie_mediawiki.php");

2. Put XFeeds.php and simplepie_mediawiki.php in the extensions/ directory. Make sure they are readable by the Apache server (chmod 755 if using Unix/Linux).

The XFeed tags themselves can then be added to a mediawiki page like so:

<feed>http://path/to/your/feed</feed>

Marlon Pierce said...

Sorry, ignore 1/2 of the earlier comment. The XFeeds stuff was from my earlier fooling around with MagpieRSS. You just need simplepie_mediawiki.php, and the <feed/> tag is from SP, not XFeeds.

To show just the dates and titles, use

<feed showdesc="false" showdate="true">
http://path/to/feed/
</feed>