[pmwiki-users] how to specify RSS feed options using a pagelist format?

Eemeli Aro eemeli at gmail.com
Mon Oct 12 06:44:01 CDT 2009


2009/10/12 SteP <step.list+pmwiki at gmail.com>:
> My question is, how can I set feed options for script/feeds.php from a wiki page?

By setting them as HTTP GET parameters. The relevant lines from
feeds.php are these:

  # determine list of pages to display
  if (@($_REQUEST['trail'] || $_REQUEST['group'] || $_REQUEST['link']
        || $_REQUEST['name']))
    $opt = $FeedPageListOpt;
  else if (preg_match("/^$CategoryGroup\\./", $pagename))
    $opt = $FeedCategoryOpt;
  else if ($action != 'dc') $opt = $FeedTrailOpt;
  else {
    PCache($pagename, $page);
    $pagelist = array($pagename);
  }
  if (!@$pagelist) {
    $opt = array_merge($opt, @$_REQUEST);
    $pagelist = MakePageList($pagename, $opt, 0);
  }

So if I've understood your situation correctly, you'll want a section
[[#feed-options]] on Group.Page or Site.LocalTemplates. Then, you
should use a location like
<http://example.com/wiki/Group/Page?action=rss&group=Group&fmt=#feed-options>.
Note that the group=Group or another condition is required so you
won't have the above if..else construct defaulting to the current page
as the $pagelist.

For a cleaner URL, you should set something like the following on the
page's or group's config file (Group.Page.php or Group.php), adjusted
of course for your configuration:

  if ($action == 'rss') {
    SDV($_REQUEST['group'], 'Group');
    SDV($_REQUEST['fmt'], '#feed-options');
  }

After which <http://example.com/wiki/Group/Page?action=rss> should
work with your desired configuration. Note that I haven't tested any
of the above code, but it ought to work.

eemeli



More information about the pmwiki-users mailing list