[pmwiki-users] Re: Re: Re: variables for customization

Patrick R. Michaud pmichaud at pobox.com
Thu Jul 7 09:04:50 CDT 2005


On Thu, Jul 07, 2005 at 10:37:26AM +0200, chr at home.se wrote:
> > $pagename (the PHP variable) is not deprecated -- it still refers to the 
> > current page, same as always.  
> > 
> > $PageName (the FmtPageName substitution used in v1, note the 
> > capitalization) is deprecated, and is now just $Name.  
> 
> The thing that confused me was that php doesn't differentiate between 
> $pagename and $PageName... Anyway, now I understand that when you write 
> "$PageName" you mean the substitution, and with "$pagename" you mean the 
> php variable.

More to the point:  Since October 2004 I've *stopped* writing "$PageName"
altogether, and the substitution is now "$FullName".  :-) :-) :-)

> > > PS. It'd be really convenient for writing scripts if '$name' and '$group' 
> > > where available... I don't know how many times I've done this:
> > > 
> > > 	$group = FmtPageName("$Group", $pagename);
> > 
> > Consider the following url:
> > 
> >     http://www.example.com/pmwiki/pmwiki.php
> > 
> > What value should $group and $name have when local/config.php is 
> > called...?  And should scripts/recipes rely on those values?
> 
> Um... I'd expect $group to be assigned according to
> 
>  	$group = FmtPageName("$Group", $pagename);
> 
> which ought to be well defined even when accessing 
> 
> 	http://www.example.com/pmwiki/pmwiki.php
> 
> Or am I missing something?  

Yes.  

Since the url doesn't have a pagename in it, $pagename isn't
set to a value (or it's a null string).  It will eventually be set
to the value of $DefaultPage, which in turn will be set based upon
the values of $DefaultGroup and $DefaultName.  However, those values
can't be known until *after* local/config.php has been loaded, so
$pagename isn't set (by PmWiki) until then.  

Pm



More information about the pmwiki-users mailing list