[pmwiki-users] Group name variables
christian.ridderstrom at gmail.com
christian.ridderstrom at gmail.com
Tue Jan 24 12:42:15 CST 2006
On Tue, 24 Jan 2006, Patrick R. Michaud wrote:
> On Tue, Jan 24, 2006 at 05:12:08PM +0100, Tim Ahrentlov wrote:
> > Hi,
> >
> > I need to check for group names (like site, main, etc) in config.php Are
> > there some variable in which this group name resides? Just like the action
> > is stored in $action? I've tried various variables I spotted as likely
> > candidates in pmwiki.php but no dice.
>
> There's not a variable that contains it, but you can obtain the
> group name of any page by using:
>
> $group = PageVar($pagename, '{$Group}');
>
> Note that this doesn't work if $pagename is empty or not a true
> pagename in the form "Group.Name".
>
> Starting with beta21, the ideal sequence will be something like:
>
> $pagename = InitPageName($pagename);
> $group = PageVar($pagename, '{$Group}');
>
> which will first resolve $pagename to its "correct" value
> (based on $DefaultPage, $DefaultGroup, UTF-8 settings, etc.)
> and then obtain the group.
Given how frequent this question is, maybe the above deserves its own
function? Perhaps
$group = DetermineNameOfGroup($pagename);
would work. Not sure were to document it though... how about:
http://pmwiki.org/wiki/PmWiki/Functions
http://pmwiki.org/wiki/PmWiki/FmtPageName
or perhaps we don't need a function, and the snippet of code could go into
http://pmwiki.org/wiki/PmWiki/LocalCustomizations
http://pmwiki.org/wiki/PmWiki/PerGroupCustomizations
Not really sure what's good here...
/Christian
--
Christian Ridderström, +46-8-768 39 44 http://www.md.kth.se/~chr
More information about the pmwiki-users
mailing list