[pmwiki-users] Different template for individual pages?

Patrick R. Michaud pmichaud at pobox.com
Thu Feb 16 18:34:53 CST 2006


On Fri, Feb 17, 2006 at 12:19:30AM +0000, Susan wrote:
> Patrick R. Michaud <pmichaud <at> pobox.com> writes:
> > I would've written
> > the above as:
> > 
> >     $Skin = 'light';
> >     $pagename = ResolvePageName($pagename);
> >     if ($pagename == 'Main.WikiSandbox') $Skin = 'pmwiki';
> > 
> 
> New to PHP. Picking up tiny bits by looking at the snippets here.
> 
> What does the function ResolvePageName do?

It turns whatever pagename has been provided by the url into
the real, full pagename for the current page.

For example, the url  http://www.pmwiki.org/wiki/Main
starts out with $pagename set to "Main".  But "Main" isn't the
name of a page, it's a partial pagename that has to be resolved
to its complete name.  Thus, ResolvePageName() takes care of
converting "Main" to "Main.HomePage" (or whatever is appropriate).

One might ask:  "Why doesn't PmWiki just do this automatically when
the script begins?" The answer is that the administrator may choose 
to set new values for $DefaultGroup, $DefaultName, or $DefaultPage, so
PmWiki can't really know what the correct resolution of $pagename
will be until after local customizations have been processed (or
the admin explicitly calls ResolvePageName, as above).

Hope this helps (and hope it wasn't too much detail).

Pm




More information about the pmwiki-users mailing list