[pmwiki-users] Category.Categories ?

Peter Bowers pbowers at pobox.com
Mon Nov 23 03:20:40 CST 2015


On Sun, Nov 22, 2015 at 6:55 PM, Donald Z. Osborn <dzosborn at gmail.com>
wrote:

> Experimenting with categories, and seems to be going well, but wanted to
> set the default page as Category.Categories rather than Category.Category
> or Category.HomePage. Did a group config file Category.php including the
> following lines but the site still wants to call Catagory.Category. Not the
> first group config I've done so thought it would be simple.



In http://www.pmwiki.org/wiki/PmWiki/BasicVariables#DefaultPage the
definition of $DefaultPage makes specific reference to the importance of
setting these variables (including $DefaultName) before any call to
ResolvePageName() - presumably because it gets cached there.

If you look at pmwiki.php it first calls farmconfig, then config, then
scripts/stdconfig which calls ResolvePageName and then calls scripts/pgcust
which handles any per-group or per-page customization. Thus ResolvePageName
is always called before any per-page or per-group customization.

Since you are already putting a conditional regarding the group name (which
wouldn't be necessary if you were to keep it in the group customization
file), why don't you put this part (setting of $DefaultName) in config.php
instead of in the per-group customization script?

Do note that the conditional as you have it will not respond if someone has
specified just "Category" as the groupname (since there is no period or
slash coming after it). You might want to consider something like this:

if (preg_match('!^GroupTest(?:[./]|$)!', $pagename))
 $DefaultName = 'Xyz';

Hmmm... Even after I do this I find that MakePageName() is forcing the
pagename to be GroupTest.GroupTest instead of GroupTest.Xyz. Shouldn't it
be paying attention to the $DefaultName? I find this true regardless of
whether I go to a url (?n=GroupTest or ?n=GroupTest.) or if I use an
in-markup link ([[GroupTest.]]). Is this something I should put in PITS or
am I not understanding how default group names are supposed to work or is
something messed up in my system?

Regardless, hopefully this has peeled a couple layers of the onion away
from the problem.

-Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20151123/75855b40/attachment.html>


More information about the pmwiki-users mailing list