Wiki source for Mod006bRecentChangesXML


Show raw source

==== Wikka Mod 006 ====
Type: Bug fix
----
===Credit:===
**""MatthiasAppel""**
[[http://web.archive.org/web/20040810215014/http://www.wakkawiki.com/MatthiasAppel | MatthiasAppel]]
**IanAndolina**
[[http://web.archive.org/web/20041204030136/http://nontroppo.org/wiki/ | http://nontroppo.org/wiki/]] //(archive)//
**[[http://web.archive.org/web/20040811013824/http://www.wakkawiki.com/SaschaCarlin | SaschaCarlin]]**
[[http://web.archive.org/web/20040813204846/http://www.wakkawiki.com/RecentChangesRss | RecentChangesRss @ WakkaWiki]]
----

Wakka has a XML link on the RecentChanges page, but it didn't work.
Grabbed a working implementation from Gadma/Nontroppo.

Modified:
/wakka.php
/actions/recentchanges.php

----

**Updated**

Switched over to implementation from ""SaschaCarlin"".
[[http://web.archive.org/web/20040813204846/http://www.wakkawiki.com/RecentChangesRss | RecentChangesRss]]

... and then merged it just a bit with some of the Gadma/nontroppo code. Here's the final code:

**handlers/page/recentchanges.xml.php**
%%(php)
<?php
header("Content-type: text/xml");

$xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
$xml .= "<rss version=\"0.92\">\n";
$xml .= "<channel>\n";
$xml .= "<title>".$this->GetConfigValue("wakka_name")." - ".$this->tag."</title>\n";
$xml .= "<link>".$this->GetConfigValue("base_url")."</link>\n";
$xml .= "<description>Recent changes of ".$this->GetConfigValue("wakka_name")."</description>\n";
$xml .= "<language>en-us</language>\n";

if ($pages = $this->LoadRecentlyChanged())
{
$max = $this->GetConfigValue("xml_recent_changes");

$c = 0;
foreach ($pages as $page)
{
$c++;
if (($c <= $max) || !$max)
{
$xml .= "<item>\n";
$xml .= "<title>".$page["tag"]."</title>\n";
$xml .= "<link>".$this->href("show", $page["tag"], "time=".urlencode($page["time"]))."</link>\n";
$xml .= "\t<description>".$page["time"]." by ".$page["user"]." - ".$page["note"]."</description>\n";
//$xml .= "\t<guid>".$page["id"]."</guid>";
$xml .= "\t<pubDate>".date("r",strtotime($page["time"]))."</pubDate>\n";
$xml .= "</item>\n";
}
}
}
else
{
$xml .= "<item>\n";
$xml .= "<title>Error</title>\n";
$xml .= "<link>".$this->href("show")."</link>\n";
$xml .= "<description>You're not allowed to access this information.</description>\n";
$xml .= "</item>\n";
}

$xml .= "</channel>\n";
$xml .= "</rss>\n";

print($xml);

?>
%%
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki