[pmwiki-users] $FmtV and $FmtP

Patrick R. Michaud pmichaud at pobox.com
Mon Jun 20 16:16:36 CDT 2005


On Thu, Jun 02, 2005 at 07:51:45AM +0200, chr at home.se wrote:
> 
> > Variables generally get documented at 
> > http://www.pmwiki.org/wiki/PmWiki/Variables, although not all of them
> > are documented yet (there are so many!).  If you need specific variables
> > documented then let me know and I'll see about adding them.
> 
> If you give me a rough description of $FmtV and $FmtP, I can polish it a 
> bit and add it... (I believe I've asked a while back about these 
> variables - can't remember why right now, but it can't hurt to have them 
> documented...).

$FmtV is a simple array of string=>substitution values that are made
at the end of a call to FmtPageName.  It's intended to be a place to
store substitution variables that have frequently changing values
(so the variable cache doesn't have to be constantly rebuilt).

$FmtP is a set of pattern=>replacement values that is used near
the beginning of FmtPageName to convert $-substitutions that are
"dynamic" depending on the pagename sent to FmtPageName.

Here's the whole FmtPageName process:

1.  Replace any sequences of the form $XyzFmt with their
    global variable value.
2.  Process the string for any $[...] phrases, using the currently
    loaded translation tables.
3.  Perform any pattern replacements from the $FmtP array.  Typically
    this is used to handle things like $Name, $Group, $FullName,
    $Title, $LastModified, etc. that are specific to the pagename
    passed as an argument to FmtPagename.
4.  If $EnablePathInfo isn't set, convert urls to use the 
    $ScriptUrl?n=Group.Name syntax instead of $ScriptUrl/Group/Name .
5.  Replace any $-sequences with global variables (caching as needed)
    of the same name (in reverse alphabetical order) *
6.  Replace any $-sequences with values out of the $FmtV array.

Step 5 can be sort of expensive, so $FmtV exists as a way to
avoid rebuilding the cache for frequently-varying values.

Pm



More information about the pmwiki-users mailing list