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

Josh Miller josh at virtualmillers.net
Sun Feb 11 19:40:08 CST 2007


-----Original Message-----
From: Patrick R. Michaud [mailto:pmichaud at pobox.com] 
Sent: Monday, February 05, 2007 9:00 PM
To: Josh Miller
Cc: pmwiki-users at pmichaud.com
Subject: Re: [pmwiki-users] Function to get list of groups and pages in a
specified group

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[$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.

Patrick:

Sorry it took me a couple of days to get back to this...
I tried the above code but it gave me a Group.Page listing of all the pages
in the site instead of just a list of groups.
Any other ideas?
Anyone?

Thanks!

-Josh
Gouverneur NY







More information about the pmwiki-users mailing list