[pmwiki-users] Re: variables for customization

Patrick R. Michaud pmichaud at pobox.com
Wed Jul 6 20:12:36 CDT 2005


On Thu, Jul 07, 2005 at 01:57:54AM +0200, chr at home.se wrote:
> 
> 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.

I'm afraid I'm not following the proposal exactly.  Let me give an
example:  In (:pagelist:), the administrator can control the output
format by setting strings such as

  $FPLByGroupGFmt = "<dt><a href='\$ScriptUrl/\$Group'>\$Group</a> /</dt>\n";
  $FPLByGroupIFmt = "<dd><a href='\$PageUrl'>\$Name</a></dd>\n";

which controls the output for each group and name that is output in
the list.  The $Group, $PageUrl, and $Name substitutions all change
for each page in the list.

Are you proposing that we change this to be

  $FPLByGroupGFmt = "<dt><a href='\$ScriptUrl/Group()'>Group()</a> /</dt>\n";
  $FPLByGroupIFmt = "<dd><a href='PageUrl()'>Name()</a></dd>\n";

instead?  We would also need to do this in skin templates and basically
all other $...Fmt variables where these substitutions are being performed.
I also suspect that by using parens we'd be just moving to a different 
kind of confusion, so that admins start believing that Group(), 
PageUrl(), Name(), etc. are somehow "real functions".  Then they'll
be confused when 

  $SomeFmt = "text with MySpecialFunction() in it"

doesn't call MySpecialFunction() the way the others do.

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

In the context of the original statements quoted above, we were (or 
at least I was) talking specifically about {$Group} as markup and not 
FmtPageName or PHP variables.

> * 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?

I prefer PHP variables.

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

Yes, this is why I think of them as markup and not "variables".  
"Markup variables" works for me as well.  Jo suggested "placeholder" 
for these.

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

Needs to be restated:  

* Format variables, e.g., "$FullName" and "$PageUrl" that you can
  give to FmtPageName() and have it interpret the variable for the
  page name given as the second argument to FmtPageName() (which may
  have nothing to do with the "current" page as the browser sees it).

Pm



More information about the pmwiki-users mailing list