[pmwiki-users] $PagePathFmt sometimes not working for me

Petko Yotov 5ko at 5ko.fr
Fri Jan 1 11:05:23 PST 2021


On 31/12/2020 22:44, Robert Riebisch wrote:
> $DefaultGroup = 'Wiki';
> $DefaultName = 'Start';
> $PagePathFmt = array('{$Group}.$1','$1.{$DefaultName}');
> 
...
> Input: https://www.domain.tld/Foo
> Output: The page "Foo" doesn't exist. (Create Foo.Foo).
> Result: Wrong. I would expect: The page "Start" doesn't exist. (Create
> Foo.Start).

This happens on the last line of ResolvePageName() which is such an 
important function, with too many things and recipes depending on it, 
that I am unwilling to change it if it doesn't work as you would expect 
in your highly specific case (custom $DefaultName, custom $PagePathFmt, 
missing group homepage).

As usual with PmWiki, you can fix that specific case in config.php:

   if(preg_match("/^$GroupPattern$/", $pagename)) {
     $pagename = MakePageName("$DefaultGroup.$DefaultName",
       "$pagename.$DefaultName");
   }

This should be placed after you configure $GroupPattern, $DefaultGroup 
and $DefaultName, and after you include scripts/xlpage-utf-8.php where 
$GroupPattern is redefined.

> Is the behavior related to my .htaccess file

No, it would do the same if you browsed to pmwiki.php?n=Foo

Petko



More information about the pmwiki-users mailing list