[pmwiki-users] variables for customization

Joachim Durchholz jo at durchholz.org
Wed Jul 6 16:54:49 CDT 2005


Patrick R. Michaud wrote:

> On Wed, Jul 06, 2005 at 10:32:24PM +0200, Joachim Durchholz wrote:
> 
>> Patrick R. Michaud wrote:
>> 
>>> On Wed, Jul 06, 2005 at 08:49:45AM +0200, Christophe David wrote:
>>> 
>>> 
>>> 
>>>> According to the documentation (snippets below), I would expect
>>>>  "page" as $PageName, and not "group.page" .
>>> 
>>> The documentation is wrong there; none of $Group, $PageName, and
>>>  $FullName are variables in the normal sense.  They're only
>>> available through FmtPageName().
>> 
>> Actually the docs are right - I think Christophe took the
>> information from http://www.pmwiki.org/wiki/PmWiki.BasicVariables ,
>> which documents the variables available to module writers.
> 
> No.  None of $Group, $PageName, or $FullName are PHP variables -- 
> they only exist as available substitutions within FmtPageName. In
> particular, a script author cannot do something like:
> 
>     if ($Group == "PmWiki") {
>       # configuration stuff specific to PmWiki group
>     }

Ah, now I see.
($pagename actually exists as a PHP variable.)

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. 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.)
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.)

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.)

Thanks :-)
(Just hoping that these changes aren't introducing too many 
incompatibilities or too much work...)

>> The variables available to page writers are documented on 
>> http://www.pmwiki.org/wiki/PmWiki/MarkupMasterIndex , right in the
>> first section.
> 
> Please, these latter items aren't "variables", they're markup. Some
> of them happen to correspond to variables available in PHP scripts,
> but they aren't themselves variables, and a markup author cannot do
> anything to "vary" them.

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.

Regards,
Jo



More information about the pmwiki-users mailing list