[pmwiki-devel] How to properly read a PTV in a function
Petko Yotov
5ko at 5ko.fr
Mon Jan 18 20:37:27 CST 2010
On Tuesday 19 January 2010 01:42:21, Randy Brown wrote :
> On Jan 18, 2010, at 4:42 PM, Petko Yotov wrote:
> >> Isn't it more something like {Main.MyPage$FullName}?action= ...?
>
> An echo in my script shows that the variable contains what you suggested.
> And I would think that would work, if it could get that value back to the
> page. However, the link shown on the page omits the "$". (Unless I turn
> off Relative Page Vars.) I have no idea why
Oh, this looks like your markup is called after PageVariables have already
been expanded. You can normally call the function PRR() to restart the markup
engine on your result, something like this at the end of your function:
PRR();
return $result;
or even simply
return PRR($result);
> >> How can I prevent it?
> >
> > $QualifyPatterns is an array containing the re-writing rules. If you
> > globally unset() it before calling PageVar(), and restore it after, it
> > should work (untested, I'm not sure if it is the best way to do this).
>
> I don't know how to globally unset() and restore.
I'd copy the array in a local variable, unset it, and later re-create it from
the local variable :
global $QualifyPatterns;
$qp = $QualifyPatterns; # copy to $qp
unset($QualifyPatterns); # unset
$val= PageVar($mypage,'$:MyPTV'); # do stuff
$QualifyPatterns = $qp; # restore (don't forget)
Petko
More information about the pmwiki-devel
mailing list