[pmwiki-users] Re: variables for customization

chr at home.se chr at home.se
Wed Jul 6 18:57:54 CDT 2005


I noticed that the thread has contineued, so I'll post here again.

On Wed, 6 Jul 2005, Patrick R. Michaud wrote:

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

What if we introduced some functions such as Group($p = $pagename) and
FullName($p = $pagename)  for script authors and administrators to use?
Then it is much clearer that we can't assign these arbitrarily, but they
are still easily available. They don't have to be variables (in fact, it's 
better if they aren't), but it'd be really helpful if this data is easy to 
come by.


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

When writing some php code like this

	$g = FmtPageName("$Group", $pagename)

do you consider '$Group' to be "markup"? To me "markup" refers to what we
use when writing wiki pages, so I might get confused.

Referring to '$Group' as a "placeholder" is slightly easier to understand,
another alternative might be to call it 'substitution symbol', or perhaps
'format variable'. Or perhaps 'formatting instruction'?

Anyway, here's an attempt at clarifying the terminology, we have:

* PHP variables: The good 'ol php variables used by pmwiki.php and 
  friends. I'd like to call these 'pmwiki variables', but that'd probably 
  be confusing so maybe simply 'php variables' or 'script variables' is 
  better?

* Markup variables, e.g. "{$Name}" or "{$Group}" that you can write in a
  wiki page and have it replaced with something.

* Format variables, e.g. "$FullName" that you can give to FmtPageName()
  and have it interpret the symbol under the assumption that the current
  page is a specific page.

I hope there isn't anything else that can be considered a variable here...  
and I do think we *really* need better names for the stuff above.  
Otherwise it'll be very difficult to explain what is what...

/Christian

-- 
Christian Ridderström, +46-8-768 39 44               http://www.md.kth.se/~chr





More information about the pmwiki-users mailing list