[pmwiki-users] variables for customization

Patrick R. Michaud pmichaud at pobox.com
Wed Jul 6 17:31:18 CDT 2005


On Wed, Jul 06, 2005 at 11:54:49PM +0200, Joachim Durchholz wrote:
> To avoid this kind of mix-up in the future, I'd like to suggest the 
> following two changes:
> 1) Consistency between substitution and PHP. Variables that are 
> available as substitution variables should have the same name as their 
> PHP equivalent. 

They are.

> It's too easy to erroneously transfer information from 
> one area to another one. (E.g. $FullName that's called $pagename in its 
> PHP incarnation.)

These *aren't* the same.  $pagename is the name of the current page being
worked on.  $FullName is the "fully formatted form" of whatever page name
passed as the second parameter to FmtPageName, which isn't necessarily
$pagename.  Similarly, $Group is the group of whatever page name is
passed as the second parameter to FmtPageName, which isn't necessarily
the group of the current page being browsed.

For example, when generating the search results $FullName
refers to the full name of each page that is being output in the search
results, and not to the name of the current page.

> 2) Have a single pool of substitutable variables that's taken for 
> everything: FmtPageName, {$var} substitution, and whatever other 
> substitutions that PmWiki may do. This makes it considerably easier to 
> remember what's available where. (If a substitution isn't available in 
> some context, make it substitute to an empty string or something.)

The issue isn't that substitutions aren't available in some contexts,
the issue is that a particular substitution results in different
values in different contexts.  That's what FmtPageName does -- it
handles the substitutions in context.

> And, on a tangent:
> 3) Please make $Groupname, $Pagename, and $Fullname available in 
> config.php. These values are simply too helpful to be omitted. (Yes I 
> know they can be inferred from $pagename, but that's not what the 
> average PmWiki admin will want to do.)

No, no, no, because it will completely increase the confusion about the
substitutions taking place.  $Group, $Title, $FullName, $Name, $PageUrl,
are *not* tied to the current page being displayed, they're used for
whatever page name is being referenced, be it in a link to another page,
the title of a referenced page, etc.

> Agreeing with everything except terminology.
> I'd prefer "placeholder" over "variable" or "markup" - "variable", while 
> technically not as out-of-the-question as you make it out, would provoke 
> misunderstandings, and "markup" is definitely something else.

"Placeholder" is fine with me, but they really are markup.

Pm



More information about the pmwiki-users mailing list