Integrate RSS newsfeeds into wiki pages using magpie RSS parser in a custom Mediawiki extension:
(For example to interwiki syndicate RecentChanges pages.)
mutante 21:35, 25 Mar 2005 (CET)
Syntax
<rss>URL</rss>
Example
<rss>http://slashdot.org/slashdot.rss</rss>
Result
<rss>http://slashdot.org/slashdot.rss</rss>
Source
<?php # RSS-Feed Mediawiki extension # using magpieRSS (http://magpierss.sourceforge.net/) # by mutante 25.03.2005 # requiring magpie (see above) require_once('magpierss-0.71.1/rss_fetch.inc'); # give it a name $wgExtensionFunctions[] = "wfRssExtension"; # register with global parser (http://meta.wikimedia.org/wiki/Write_your_own_MediaWiki_extension) function wfRssExtension() { global $wgParser; # set hook (trigger) to rss, means <rss> will be made active tag $wgParser->setHook( "rss", "renderRss" ); } # the actual function (taking input) function renderRss( $input ) { # maybe its a good idea to escape string user input so they dont try to attach nasty things # $input = mysql_escape_string($input); # fetch the feed (magpie's job) $rss = fetch_rss($input); # setting variables for table head $link=$rss->channel['link']; $title=$rss->channel['title']; $cdesc=$rss->channel['description']; # putting the html table head into the output variable $output="<table><tr><th align='left' colspan='3'><i>RSS-feed included from:</th></tr> <th colspan='2'><a href='$link'>$title</a></th> <th><i>'$cdesc'</i></th></tr><tr><th>Date</th> <th>Page</th><th>Description</th></tr>"; # now a loop to add table rows until none more are found foreach ($rss->items as $item) { # setting variables for table row $href = $item['link']; $title = $item['title']; $date = $rss->dc['date']; $description = $item['description']; # adding each single row (still in loop) (.= appends = would overwrite) $output.="<tr><td>date $date</td><td colspan='1'><a href='$href'>$title</a></td><td>$description</td></tr>"; } # loop done ,adding final tag to close table properly $output.="</table>"; # dump the output all at once return $output; } ?>