Summary: RSS Output from a wikipagelist
Version: 0.9 2008-12-07
Status: BETA
Maintainer: Michael Selbmann
Categories: RSS

Questions answered by this recipe

Can we write wiki pages into an RSS-Feed? Yes, we can. :-)
How can I build an RSS-Feed from my wiki pages?


Creates RSS-Feed from wiki pages with pagelist directive


I needed that for our intranet. We needed a simple way for all users to see recent changes.


First of all put this in your local/config.php. You also can write it in an include file.

# change settings for RSS Feed
if((FmtPageName('$Group', $pagename) == "RSS") and ($Action != "edit")) 
	# Change HTML-Tags
	SDV($PageTextStartFmt, "\n\n");
	SDV($PageTextEndFmt, "\n");

	Markup('RSSP', '<<vspace>', '/<p.*?>/', '');
	Markup('RSSPEnd', '<<vspace>', '/<\/p>/', '');
	Markup('RSSCode', '<<vspace>', '/<code.*?>/', '');
	Markup('RSSCodeEnd', '<<vspace>', '/<\/code>/', '');

	# Change style path
	$Skin = 'rss';

	# simple markup for a counter
	$FmtPV['$RSSCounter'] = 0;
	function RSSCountup()
		global $FmtPV;
		$FmtPV['$RSSCounter'] = $FmtPV['$RSSCounter']+1;
		return sprintf("RSS%04d", $FmtPV['$RSSCounter']);
	Markup("rsscounter", 'directives', '/\(\:rsscount\:\)/e', 'Keep(RSSCountup())'); 

	# Enable XML Tags. Based on recipe enableHTML
	function RSSEnableXML($tag) 

Now you need a new template for that category in the folder rss.

<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
    <title>My own feed</title>
    <description>This are the recent changes.</description>
    <copyright>Mr. Right</copyright>
      <title>My own feed</title>

I used iso-8859-1 and language de-de for german umlauts. You can change it.
For more Details on RSS look in to wikipedia. :-)

Now you create a startpage/homepage for that category with a pagelist for the last recent changes.

(:if false:)(:nolinkwikiwords:) 
(:template each:)<item>\

(:pagelist trail=Site.AllRecentChanges group=-Category,-Templates count=-10 order=time wrap=inline fmt=#rss:)

See Also

XML-Tag usage based on EnableHTML.


Michael Selbmann

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.