Summary: Searching WikiWords and Links pages outside the current group
Categories: Searching, PageNaming

Searching WikiWords and Links pages outside the current group

By default, in PmWiki, WikiWords and Links pages are searched inside the current group, unless another group path is explicitly required (by OtherGroup/ThatPage or OtherGroup.ThatPage). A group is also said to be a 'Namespace'.

You may want that the WikiWords or [[Links]] pages be searched in multiple groups.

This is possible by redefining the searching path defined in the variable $PagePathFmt.

By default this is set as

$PagePathFmt = array('$Group.$1','$1.$1','$1.$DefaultName');

which says to look for a page in the current group, next in a group with the same name as the page, searching : 1/ page name identical as group name and 2/ default page name (usually 'HomePage').

You can set this variable in config.php to specify any set of groups you wish, thus

$PagePathFmt = array('$Group.$1', 'A.$1', 'B.$1', 'C.$1', '$1.$1');

says to look first in the current group, then in group A, then group B, then group C, and finally in a group with the same name as the page.

Example of a redefinition:

$PagePathFmt = array('$Group.$1','$DefaultGroup.$1',

With that, you can ultimately create a PmWiki being a unique namespace, but you should declare all shared groups in the $PagePathFmt variable, this is not automatic.

Setting your $PagePathFmt to this:

$PagePathFmt = array('$Group.$1','$1.$DefaultName');

May result in a more intuitive use of $DefaultName - it will then be the name of the homepage of all groups.

Do note that $PagePathFmt cannot be set in per-page or per-group configuration scripts.

In recent pmwiki version, the unique namespace no longer works in the SideBar (you need to define the group) while it is still ok in the body. If someone have an explanation or a solution ?


Is it because the group those links are starting from is Site.? I know this has caused problems with my SideBar pagelists. For me, using {*$Group} instead of {$Group} solved things. Maybe it could work here too? MikeShanley?

Note there is an outstanding bug PITS:01220 where references to groups are not resolved correctly when DefaultName is not GroupName (eg when DefaultName is set to HomePage)