[pmwiki-users] How to generate a list of categories?

Patrick R. Michaud pmichaud at pobox.com
Wed Jul 19 14:29:48 CDT 2006


On Wed, Jul 19, 2006 at 08:04:44PM +0200, christian.ridderstrom at gmail.com wrote:
> On Wed, 19 Jul 2006, noskule wrote:
> >Am Mittwoch, 19. Juli 2006 19:13 schrieb christian.ridderstrom at gmail.com:
> >>I'd like to generate a list of all categories that exist, how can I do
> >>this?
> >>What I am looking for is a method to list all categories, including the
> >>categories that do not have a corresponding page.
> >
> >yep, thats my question to. Could this be done with a sort
> >of "auto-generate-page" mechanism  . . ...
> 
> Um... do you also want to automatically populate the group Category/ with 
> pages? That's not what I'd like, I just want a list of categories. Each 
> category may or may not then correspond to an actual page in Category/.

I've been thinking about adjusting the [[!category]] markup so
that it automatically creates (blank) category target pages if
they don't already exist.  Then one can easily use (:pagelist:)
to generate a list of categories.  This also means we can eliminate
the current hack that suppresses Site.PageNotFound when accessing
a page in the Category group.

However, if we want to avoid the creation of empty category pages,
there's not currently a way to do that.  When (:pagelist:)
becomes smart enough to be able to display missing and orphan
pages, then it will be possible with something like:

    (:pagelist select=all group=Category:)

Other possibilities will include:

    ##   display all categories w/o Category pages
    (:pagelist select=missing group=Category:)

    ##   display all Category pages w/o category links
    (:pagelist select=orphan group=Category:)

One stumbling block I have at the moment is coming up with an
appropriate name for the "select=" option above; "status=" and
"type=" have been proposed (but are probably too generic).
The defined values for the option, whatever it ends up being 
called, will be:

    existing       display only pages that exist
    missing        display pages that don't exist but have incoming links
    orphan         display pages that exist but have no incoming links
    all            display all target and existing pages

Pm




More information about the pmwiki-users mailing list