[pmwiki-users] Noobie Question: PmWiki 2.0 Categories
John Rankin
john.rankin at affinity.co.nz
Mon Feb 21 18:21:33 CST 2005
On Monday, 21 February 2005 7:27 PM, Grorge J. De Bruin <gdb at soundchasers.com> wrote:
>Hello All,
>
>I've been reading the UsingCategories page, and I
>keep getting lost. I'm okay up until the point
>where it says "So, that's really all there is to
>categories. But wait, there's more!", from this
>point on the explanation of what John and Patrick
>have come up with, while looking completely
>utilitarian, and exactly what I want/need/desire,
>leaves me completely lost.
>
>Any chance anyone else has a good exmplanation of
>how this works?
>
Short answer:
- on any page, use the [[!category]] markup. For example,
on the page Film.HouseOfFlyingDaggers we might write
[[!China]]
- create a page called Category.GroupFooter with the
following content
(:pagelist !{$Name}:)
That's it. If you click on the China link, you will see
a list of all pages in Category.China.
Taking a deep breath...
In my mind, there are 3 requirements:
1. we want to access wiki pages by their subject(s), where
a page can have one or more subject categories
2. we want to organise the categories themselves into some
kind of logical structure
3. we want to control the vocabulary used to categorise
pages
Requirements 2 and 3 may not be needed, so let's focus on 1.
How do we access pages by their subject(s)? These are the
things we want to achieve:
a. an author can easily assign categories to pages
b. a searcher can find pages in a given category, without
inadvertently also finding pages that include the
category as a word in the page text
c. we want the access by category to be automatic: if we
add a page to or remove it from a category, the lists
of pages by category are updated (ie, we don't want to
have to maintain separate lists of pages by category;
unlike RecentChanges pages, where if we delete a page,
it still shows up on RecentChanges)
d. we have to be able to explain categories to new authors
in a way that makes the idea easy to understand; this
is an attempt...
So how do we achieve this:
a. an author assigns pages to categories by writing
[[!some category]] eg [[!horror]]
the wiki interprets this as [[Category/horror]]
b. a searcher enters !horror in the search box; if we
had asked the author to enter [[Category/horror]],
the search can't tell whether a particular reference
to horror' is a category reference or a general one
c. we want the Category group to have a page per category,
listing the pages in that category; we achieve this by
combining 3 pmwiki capabilities:
- a GroupFooter page will display the same text on every
page in the group
- the {$Name} markup is translated into the name of
the current page
- the (:pagelist ... :) markup initiates a search for
... and displays the results, sorted by $FullName of
the pages found
So if we put the following on Category.GroupFooter page
(:pagelist !{$Name}:)
we will automatically get a list of the pages in any
given category, such as the Category.Horror page.
What if...
What happens if the Category.Horror page doesn't
exist? Well, the way pmwiki treats [[!category]]
markup, clicking on a category always takes you to
the corresponding page in the Category group, so
you always see a list of pages in that category.
For example, suppose on the page Film.SeanOfTheDead
we have [[!horror]]. Clicking on 'horror' will
take you to the page Category.Horror, and display
the 'Describe Category.Horror here' default text,
plus the result of the (:pagelist !Horror:) search.
Of course, if a Category.Horror page exists, we will
see the text of the page, plus the pagelist.
d. Hope this helps to clarify. We can cover the other 2
requirements another day.
--
JR
--
John Rankin
More information about the pmwiki-users
mailing list