[pmwiki-users] Tiddlywiki-style tagging

Eemeli Aro eemeli at gmail.com
Thu Aug 13 15:53:44 CDT 2009


2009/8/13 Michael Fake <michael.j.fake at googlemail.com>:
> Thanks so much for the speedy response, but I'm afraid this doesn't quite do
> what I want. If I understand it right, this will list every page that has a
> link [[Main/Dogs]] anywhere inside it, whereas I want the list to ONLY show
> pages that I have tagged on purpose. e.g. I want to be able to write "cats
> and [[Dogs]] don't get on" in one page, without it then showing up in the
> list of pages tagged with "Dog".

I assume you've looked at
<http://www.pmwiki.org/wiki/PmWiki/Categories> and have come across
the [[!Category name]] markup?

The simple answer, if you're ok with a redirect, would be to add the
following to the page Category.GroupFooter:

(:redirect Main.{*$Name} quiet=1:)

Then any category link will first lead to eg. Category.Dogs, which
will return a redirect to the browser pointing at Main.Dogs. You could
even tune it so that it'll only redirect if the target page actually
exists:

(:if exists Main.{*$Name}:)
(:redirect Main.{*$Name} quiet=1:)
(:ifend:)

For a single link that'll both tell PmWiki that you want to categorise
this page under Dogs and lead directly to the page Main.Dogs while not
making every link to Main.Dogs categorise the page it's on under Dogs,
the best I can come up with a perversion of the value of $PageUrl for
category pages. Hence, you could try adding the following to a config
file:

$FmtPV['$PageUrl'] = 'PUE(
  ($group=="Category")
    ? ( ($EnablePathInfo) ? "$ScriptUrl/Main/$name" :
"$ScriptUrl?n=Main.$name") )
    : ( ($EnablePathInfo) ? "$ScriptUrl/$group/$name" :
"$ScriptUrl?n=$group.$name") )';

Then every link to a category page will internally count as a category
link so you can use expressions such as (:pagelist
link=Category.Dogs:) but will lead to a page in the Main group with
the same name. Note that doing anything with category pages may become
rather difficult after this.

For some more help with tagging, take a look also at
<http://www.pmwiki.org/wiki/Cookbook/Bloge-Tags>.

eemeli



More information about the pmwiki-users mailing list