[pmwiki-users] FmtPageName

Patrick R. Michaud pmichaud at pobox.com
Mon Jul 11 02:10:34 CDT 2005


On Mon, Jul 11, 2005 at 08:00:45AM +0100, Hans wrote:
> I am struggling with FmtPageName. I must admit that i thought the
> recent discussion gave me more insight into the workings of this, but
> the documentation page does not give me much help.
> 
> I would like to have the page title returned.
> I use
>    $pvar = FmtPageName('$Title',$pagename);
> this returns the page name, spaced, not the title as in (:title
> mytitle:) markup.

At the moment, $Title, $LastModified, $LastModifiedBy, and 
$LastModifiedHost can only work if the page's attributes have been 
loaded and cached using the PCache function.   So, to get
at these values one must typically do:

   $page = ReadPage($pagename);
   PCache($pagename, $page);
   $pvar = FmtPageName('$Title', $pagename);
   $pvar = FmtPageName('$LastModifiedBy', $pagename);

I've thought about improving this so that FmtPageName automatically
handles calls to load/PCache as needed, but haven't done this yet 
because I generally want to avoid the overhead of unnecessary page loads
(and FmtPageName is time consuming enough already!).

> Just using $Title in the skin.php script does not work either.

...because at the time skin.php is being processed the page has
generally not been loaded/cached yet.  For most skins the $Title
substitution doesn't get processed until the page is being output,
as opposed to when the skin is being loaded.

Pm



More information about the pmwiki-users mailing list