[pmwiki-users] wiki groups

Patrick R. Michaud pmichaud at pobox.com
Wed Mar 15 09:46:49 CST 2006


On Wed, Mar 15, 2006 at 03:41:44PM +0100, Marco Ferretti wrote:
> Can somobody point me @ how I can get and array/list of all the existing wiki 
> groups in pmwiki ? 

Answer 1:

    $list = ListPages();
    foreach($list as $pn) {
      $group = PageVar($pn, '$Group');
      $grouplist[$group]++;
    }

When done, the keys of $grouplist will be the existing groups.
(As a bonus, the values of $grouplist will be the number of pages in
each group.)

Answer 2:

    $list = MakePageList($pagename, array('list' => 'normal'), 0);
    foreach($list as $pn)
      $group = PageVar($pn, '$Group');
      $grouplist[$group]++;
    }

Same as above, but uses the "list=" option (from pagelist) to
restrict the pages to those that are "normal"  -- i.e., excluding
AllRecentChanges, RecentChanges, GroupHeader, GroupFooter, etc.
Of course, one could choose a different list= option to exclude
things such as PmWiki, Site, etc., or pass other options
besides list= .

Pm





More information about the pmwiki-users mailing list