User:Mutante/RSSFeed

From Meta, a Wikimedia project coordination wiki
Jump to: navigation, search
Blue Glass Arrow.svg MediaWiki logo.png
This page should be moved to MediaWiki.org.
Please do not move the page by hand. It will be imported by a MediaWiki.org administrator with the full edit history. In the meantime, you may continue to edit the page as normal.

Integrate RSS feeds into wiki pages using magpieRSS (a PHP RSS parser class) in a custom Mediawiki extension:

(For example to interwiki syndicate RecentChanges pages.)

Mutante 20:57, 25 Mar 2005 (UTC)

The starting idea behind this was to integrate the RecentChanges pages of the neighbor wikis. Since all Mediawikis produce an RSS feed of their RC pages. And we were thinking of even making this an automatic feature, (read from "interwiki" sql table and auto-include RCs of other Wikis in according wiki page like /Feeds/OtherWiki/RecentChanges. (original idea by mattis manzel) (http://s23.org/wiki/index.php/RecentChangesOfOurNeighbors) Mutante 10:56, 21 May 2005 (UTC)


Syntax[edit]

<rss>URL</rss>

Example[edit]

<rss>http://www.download.com/3410-2012-0-10.xml</rss>

Result[edit]

<rss>http://slashdot.org/slashdot.rss</rss>

(not installed on wikipedia, but here)

Source[edit]

<?php
# RSS-Feed Mediawiki extension
# using magpieRSS (http://magpierss.sourceforge.net/)
# by mutante 25.03.2005

require_once('magpierss-0.71.1/rss_fetch.inc');
$wgExtensionFunctions[] = "wfRssExtension";

function wfRssExtension() {
    global $wgParser;
    $wgParser->setHook( "rss", "renderRss" );
}


function renderRss( $input ) {

    # $input = mysql_escape_string($input);

    $rss = fetch_rss($input);

    $output="<table><tr><th>Channel Title: </th><th>" . $rss->channel['title'] . "</th></tr>";
    $output.="<tr><td>";
    foreach ($rss->items as $item) {
        $href = $item['link'];
        $title = $item['title'];
        $output.="<td colspan='2'><a href='$href'>$title</a></td></tr>";
    }
    $output.="</table>";

    return $output;
}

?>

Improved Version by Duesentrieb[edit]

Also have a look at User:Duesentrieb/RSS for a modified version with a few more features -- Duesentrieb 01:29, 2 May 2005 (UTC)

This includes converting different charsets using iconv and an option to hide the description (shortened list). Thanks for your help , Duesentrieb, I didnt feel like messing with the charset conversion especially. Mutante 22:31, 5 May 2005 (UTC)

Further improved the extension (User:Rdb78/RSS) to allow setting the number of headlines -- Rdb78 8 July 2005 02:43 (UTC)
Further features added : highlighting and filtering, see RSS - Mafs 20:38, 10 July 2005 (UTC)

I found something probably serious: When I add bugzilla created rss feeds as

<rss>https://bugzilla.mozilla.org/buglist.cgi?query_format=specific&bug_status=__open__&product=Minimo&content=folder%20rss&ctype=rss</rss>

The page does not load any more (spinnin forever) and an error like "mismatched tag at line 34, column 4" appears in php.log

(mediawiki 1.5.4 with RSS - can somebody confirm this (also for other versions)?

I tried, and the feed just gives an error. Strange, the feed seems to validate. Could it be the https? Also this is one of those feeds that firefox tries to download instead of opening it as a xml-file. Maybe something wrong with headers in feed? (my setup:

   *  MediaWiki: 1.5.8
   * PHP: 4.3.9 (apache2handler)
   * MySQL: 3.23.58 
   * Extensions:
         o Other:
               + rss feed extension (version 09/2005), displays an rss feed on a wiki page, by mutante, Duesentrieb, Rdb, Mafs 
         o Extension functions:
               + wfRssExtension

)