> Use $HandleActions['pagerss'] = 'YourFunction'; Thanks for the quick response! $HandleActions was just what I was looking for.
> Note that you should probably get the page history in the $page array as I > wrote above, and not from parsing the actual files : first it is easier, > second a wiki may use a PageStore class that is not plaintext files > (CompressedPageStore, SQLite, MySQL...). I looked at the $page variable, however, it only has the most recent revision information. I want to dig a little deeper and get more past revisions. I've already written a parser for the default flat files, but I would toss that aside if there was a built-in function that gets multiple past revisions. Avast! Daniel Roesler [email protected] On Sun, Jan 11, 2009 at 10:40 PM, Petko Yotov <[email protected]> wrote: > On Monday 12 January 2009 04:59:18 Daniel Roesler wrote: >> Howdy all, > > Hello. > >> I have a few questions about the order that PmWiki processes things. >> I'm trying to write a recipe that creates simple RSS feeds for pages >> detailing their revision history. Basically, my local config.php file >> looks like: >> >> if ($action == "pagerss") { >> ... >> // rssxml = parsed history (from the actual page files) >> ... >> print(rssxml); >> } >> >> First, how can I print the RSS xml that my recipe creates without >> printing the rest of the wiki? Is there a variable that sets whether >> or not the actual wiki page prints? > > Use $HandleActions['pagerss'] = 'YourFunction'; > > function YourFunction($pagename, $auth='read') > { > global $WikiDir, $FeedStartFmt, $FeedEndFmt; > > # get page content and full page history > $page = RetrieveAuthPage($pagename, $auth, true); > if(!$page) Abort("? Not enough permissions to read feed."); > > ### to see what is $page, uncomment next line: > ### echo '<pre>'; print_r($page); exit; > > # $rssxml = parsed history from the $page array, not from the actual file > > # instruct the browser that it is a feed > header("Content-type: text/xml; charset=$Charset"); > > # $FeedStartFmt contains "<?xml version=\"1.0\" encoding=\"$Charset\"?".">" > PrintFmt($pagename, $FeedStartFmt, $rssxml, $FeedEndFmt); > > } > > See how the scripts/feeds.php is written and you can learn/start from a > tweaked version of this file (copy it to your /cookbook/ directory first, > then change all function names). > >> >> Second, how do I incorporate other PmWiki variables into the function, >> such as $WikiDir and $Namespaced? In pmwiki.php, the local config.php >> file is loaded before any default variables (besides several like >> $pagename and $FarmD) are set. How can I set these default variables >> before running this recipe? > > The $HandleActions method will call the function after all variables are set. > > Note that you should probably get the page history in the $page array as I > wrote above, and not from parsing the actual files : first it is easier, > second a wiki may use a PageStore class that is not plaintext files > (CompressedPageStore, SQLite, MySQL...). > > I would suggest getting some existing recipes (feeds.php and other), learn > from them, reuse their code, tinker, test, start again. > > Thanks, > Petko > _______________________________________________ pmwiki-users mailing list [email protected] http://www.pmichaud.com/mailman/listinfo/pmwiki-users
