Patrick R. Michaud
pmichaud at pobox.com
Thu Apr 14 13:13:35 CDT 2005
On Thu, Apr 14, 2005 at 12:58:06PM -0500, Monty wrote:
> I notice that when n=Main, PmWiki automatically routes to HomePage.
> (This isn't documented anywhere I can find besides the source.)
The behavior is controlled by the $PagePathFmt variable. I thought
it was documented already but apparently it's not. Essentially,
$PagePathFmt says how to take a word and convert it into a full
pagename. The default is to look for $Group.Word (word in the current
group), Word.Word, and Word.HomePage. So, given a name like "Main",
PmWiki looks for Main in the current group, Main.Main, and Main.HomePage.
> This is similar to suppressing the "index.html" and just showing the
> directory name in a link for example http://localhost/about/index.html
> is more eloquently shortened to http://localhost/about/ where the
> software knows the default HomePage is index.html.
> What is best practice to accomplish this desire?
$DefaultPage = "$DefaultGroup.$DefaultName";
if (!$pagename) $pagename = $DefaultPage;
$p = MakePageName($DefaultPage, $pagename);
if ($p && PageExists($p)) $pagename = $p;
More information about the pmwiki-users