[Pmwiki-users] Categories instead of hierarchies?

John Rankin john.rankin
Wed Oct 20 15:34:18 CDT 2004


On Thursday, 21 October 2004 9:34 AM, Knut Alboldt <mailing at alboldt.de> wrote:
>In general, I like the category concept more than the hierachical ones.
>If it wouldn't be too many files in one directory I even would prefer no 
>group, but it is quite usable as a main category (and to keep the files 
>directories lesser).

Here is a terse proposal for handling categories. It's probably better
to answer specific questions rather than try to write a long post.

1. PmWiki 2 makes this really easy to do. (Patrick may need to correct
   any misunderstandings in what follows.)

2. Introduce the following markup

    [[/some category]] translates into [[Category/some category]]

3. Create Category.GroupHeader with the following content

    [:searchresults [[/{$Name}]]:]

4. Lets look at an example of Category pages and their contents

    FullName                Content

    Category.Category       nothing special
    Category.Genre          [[/Category]]
    Category.Horror         [[/Genre]]
    Category.Musical        [[/Genre]]
    Category.Comedy         [[/Genre]]
    Category.Drama          [[/Genre]]
    Category.Year           [[/Category]]
    Category.2001           [[/Year]]
    Category.2002           [[/Year]]
    Category.2003           [[/Year]]

5. So what displays on the pages?

   On Category.Category the GroupHeader resolves as
        [:searchresults [[/Category]]:]

   which renders as links to
        Genre
        Year

   Similarly, Category.Genre renders as links to
        Comedy
        Drama
        Horror
        Musical

   And Category.Year renders as links to
        2001
        2002
        2003

6. Now let's look at the pages called Film.SeanOfTheDead, 
   Film.InMyFathersDen, Film.TheCorporation

    FullName                Content
    Film.SeanOfTheDead      [[/Horror]], [[/Comedy]], [[/2003]]
    Film.InMyFathersDen     [[/Drama]], [[/2004]]
    Film.TheCorporation     [[/Documentary]], [[/2003]]

7. We'll get a ? against 2004 and Documentary of course. It's an
   administrator decision who gets Category creation rights.

8. If we click on 2003, we'll go to Category.2003 and see this
        Film.SeanOfTheDead
        Film.TheCorporation

9. We can enter [[/Documentary]] Michael into a search box to
   restrict searches to the Documentary category.

10. So far, all this needs is a 2 line markup extension. 

    SDV($CategoryGroup,'Category');
    Markup('[[/','<links','/\[\[(\/.*?)\]\]/',"[[$CategoryGroup$1]]");

11. We can also imagine searching a multi-level category hierarchy,
    say [[/Domestic]] with sub-categories [[/Dog]] [[/Cat]]. A search
    for [[/Domestic]] would look at all pages in the [[/Dog]] or [[/Cat]]
    categories.
    

Comments? Questions?
-- 
JR
--
John Rankin





More information about the pmwiki-users mailing list