[Pmwiki-users] Group "index" pages and practices

Patrick R. Michaud pmichaud
Mon Jan 17 08:28:25 CST 2005


On Sun, Jan 16, 2005 at 03:53:14PM -0900, Chris Lott wrote:
> I'm confused about the distinction between
> GroupName/GroupName
> GroupName/HomePage
> GroupName/Main (/MainPage)
> 
> Are any of these special or "magical" in any way? 
> Why choose one or the other? 

By default only GroupName/GroupName and GroupName/HomePage have
any "magic" associated with them.  (AFAIK, there's not a GroupName/Main
default.)

When given a page name (e.g., SomeName) that doesn't have some sort of 
group qualifier, PmWiki checks to see if any of the following exists
    - a page named SomeName in the current group
    - a page named SomeName.SomeName
    - a page named SomeName.HomePage
and uses the first one that it finds.  If it doesn't find one of these
pages, then PmWiki assumes that "SomeName" refers to a non-existent 
page in the current group.

The idea is that a group's "start page" has either the same name as the
group or is named "HomePage".  This is useful in two ways:
    - it makes it easy to link to the start page of a group by simply
      using the group name as a link
    - when given a URL that has just a group name and no page name,
      PmWiki can redirect the browser to that group's start page

> ... how does PmWiki decide to make a link to
> a Group index page instead of a page in that group (if they have the
> same name)? 

PmWiki decides according to $PagePathFmt, which defaults to the order
given above.  More on this in a bit...

> For instance, if I have GroupA/HomePage created and then
> from the Main page I createa plain link of GroupA (or [[GroupA]]), it
> links to the Group Index, meaning one can't have a subpage of the main
> group that is the same name as the group?

Yes, you can have that -- you just have to create Main/GroupA somehow,
at which point [[GroupA]] will correctly refer to GroupA in the current
group instead of the start page of GroupA.  To create Main/GroupA, you
can do either of:
    - create a link as [[Main/GroupA]], then use that to create the page
    - go directly to http://<yourserver>/wiki/Main/GroupA and hit "Edit Page"


You can change PmWiki's behavior here by customizing the $PagePathFmt
variable.  By default $PagePathFmt is set to

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

where $1 is the name to be tested.  Thus, this says to look first in
the current group for a page of that name, then look for the page in a
group of the same name, then look for $DefaultPage (normally "HomePage")
in the named group.  So, if you wanted to only look for names in the
current group, you can set (in config.php):

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

Similarly, if you want to prefer SomeName.HomePage over SomeName.SomeName,
you can use:

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

Hope this helps,

Pm



More information about the pmwiki-users mailing list