[pmwiki-users] Small problem with changed default page

Stirling Westrup sti at pooq.com
Sun Jan 20 15:48:21 CST 2008


Anke Wehner wrote:
> Hello.
> 
> I have the following in my config.php tp change the default name:
> $DefaultName = 'Main';
> $PagePathFmt = array('$Group.$1', '$1.$DefaultName');
> 
> This works on links inside the wiki - [[Group/]] links to Group.Main
> and all - but one problem I noticed that when I change the url per
> hand, say, removing the page name, so I have ...wiki.php/Group , it
> looks for Group.Group rather than Group.Main.
> 
> Is there something obvious I missed? (I'm using  .beta65)

Alas, that is PmWiki's normal behaviour. $PagePathFmt is a /search/ path 
that tells PmWiki where to look for an under-specified page (ie, Group 
or Name part missing). It has no effect if no page is found at all. In 
that case PmWiki is hardwired to call the page $Group.$Group.

There has been some talk lately of a general mechanism to give better 
control over this, but in the meantime one has to add some code to 
config.php if they want to override the default behaviour. Something 
like this should work (note that I haven't tested this):

$DefaultName = 'Main';
if( strpos($pagename, '.') === FALSE )
   $pagename .= ".$DefaultName";

This essentially just tacks on a '.Main' to the end of any pagename that 
doesn't have a dot in it. There may be edge cases where one needs more 
complicated processing (such as, what if the input name was '.Foo'?)



More information about the pmwiki-users mailing list