[pmwiki-users] Re: Re: $DefaultName - Per Group Custom

Patrick R. Michaud pmichaud at pobox.com
Fri Jan 28 14:38:28 CST 2005


On Fri, Jan 28, 2005 at 12:20:22PM -0800, Iram Hernandez wrote:
> 
> I set the $DefaultPage = "TableOfContents"; on
> config.php so that that will be the default on all new
> groups.
> 
> I set the $DefaultPage = "Introduction"; on Main.php
> so that only my Main group will have the Introduction
> as the main page.
> 
> The $DefaultPage in the Main.php is not overwriting
> the $DefaultPage in the config.php.

The short answer is that you cannot set a group's $DefaultName
from within the group's configuration file.  The reason for this
is that the per-page and per-group configuration files are loaded
*after* the page's full name has been determined.  So, if config.php
sets $DefaultName to "TableOfContents" and PmWiki has only "Main"
for a pagename, it will convert that to "Main.TableOfContents" before
it ever loads the per-page or per-group customization.

> I have been able to work around the problem by setting
> in config.php
> $DefaultPage = 'Main/Introduction';
> $DefaultName = 'TableOfContents';

This works.  You could also do:

   if ($pagename == 'Main') Redirect('Main/Introduction');
   $DefaultName = 'TableOfContents';

> This does what I need but it seems to me that the
> variable in the Main.php should override the one in
> config.php

It does override it -- the problem is that it does so *after* the
page's name has been determined.

Pm



More information about the pmwiki-users mailing list