[pmwiki-users] How to retrieve the value of a Page Text Variable {Group/PageName$:Var} from a cookbook ?
marc
gmane at auxbuss.com
Sat Nov 25 08:42:27 CST 2006
Christophe David said...
> >
> > You can access page text vars via
> >
> > PageTextVar($pagename, $var)
> >
> > So,
> >
> > $fred = PageTextVar("Main.WikiSandbox", "FQDN");
> >
> > returns the equivalent of the markup
> >
> > {Main.WikiSandbox$:FQDN}
> >
> >
>
> Thanks a lot for the reply. This is indeed exactly what I was looking for.
>
> But unfortunately, I cannot get it to work ;-(
>
> I use the latest beta, and the function seems to return nothing at all.
>
> The variables work OK with the markup from other pages. But in a recipe,
> with the syntax you provided, I just get an empty string.
> Any clue would be appreciated.
You need to be very precise with what you feed it.
Try something like:
(:MRCfunc page=Main.WikiSandbox textvar=FQDN:)
Markup('MRCfunc','inline',
'/^\\(:MRCfunc(\\s.*?)?:\\)/ie',
"MRCfunc(PSS('$1'))");
function MRCfunc ($x) {
$args = ParseArgs($x);
$fred = PageTextVar($args['page'], $args['textvar']);
return "<br>:$fred:<br>";
}
--
Best,
Marc
More information about the pmwiki-users
mailing list