[pmwiki-users] Function to get list of groups and pages in a specified group

Patrick R. Michaud pmichaud at pobox.com
Mon Feb 5 19:59:37 CST 2007

On Mon, Feb 05, 2007 at 08:48:15PM -0500, Josh Miller wrote:
> Hello,
> I am looking for a function that will return all of the group names in an
> existing wiki to an array that I can then access using php.

To get a list of all pages on a site, use the ListPages() function:

    $allpages = ListPages();

To narrow that down to a list of groups, we can just strip out
everything before the period:

    $listofgroups = array();
    foreach(ListPages() as $pn) {
      $group = preg_replace('/\\..*/', '', $pn);
    $listofgroups = array_keys($listofgroups);

> After that I would also need to know the function to get the list of all
> existing pages in a group, so that if I select Animals, I get a list like
> this:

To get a list of pages within a specific group is much easier:

    $pagesingroup = ListPages('/^Group\\/.');

Yes, all of this can also be done with the pagelist.php functions,
but the above is currently quicker and a little more straightforward.


More information about the pmwiki-users mailing list