Content added Content deleted
imported>Fuckyou No edit summary |
imported>MattisManzel m (revert) |
||
Line 1: | Line 1: | ||
Integrate [[RssNewsfeeds|RSS newsfeeds]] into wiki pages using [[magpie]] RSS parser in a custom [[Mediawiki]] extension: |
|||
#REDIRECT [[Wikipedia:Image:Autofellatio_2.jpg]] |
|||
(For example to [[RecentChangesOfOurNeighbors|interwiki syndicate RecentChanges pages]].) |
|||
[[User:mutante|mutante]] 21:35, 25 Mar 2005 (CET) |
|||
=== Syntax === |
|||
<nowiki><rss>URL</rss></nowiki> |
|||
==== Example ==== |
|||
<nowiki><rss>http://slashdot.org/slashdot.rss</rss></nowiki> |
|||
=== Result === |
|||
<rss>http://slashdot.org/slashdot.rss</rss> |
|||
=== Source === |
|||
<pre> |
|||
<?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; |
|||
} |
|||
?> |
|||
</pre></nowiki> |
Revision as of 09:10, 30 March 2005
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 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; } ?>
</nowiki>