[pmwiki-users] How do I get $EditRedirectFmt also return Page Text Variables?
Patrick R. Michaud
pmichaud at pobox.com
Mon Apr 18 13:19:44 CDT 2011
On Mon, Apr 18, 2011 at 10:31:59AM -0700, Dave wrote:
> When Markup calls the function and the function modifies a variable of global
> scope what would cause the variable to revert to its unmodifed setting?
I'm assuming you're still referring to this code from your original email
(in config.php):
SDV($CompSName, 0);
Markup('CompSName','<{$var}','/\\(:CompSName: (\\w+) :\\)/e','CSName("$1")');
function CSName ($val) {
global $CompSName;
$CompSName = $val;
echo " #A- ".$CompSName; //output = RMS
}
echo " #B-".$CompSName; //output = 0
Note that Markup() doesn't call CSName itself directly, it registers
CSName as a possible function to be called later when MarkupToHTML()
is invoked on the page text. Thus if the second echo line is actually
in the config.php, it's displaying the value of $CompSName during
PmWiki initialization, which is well before the page markup is processed
or CSName() gets invoked.
Pm
More information about the pmwiki-users
mailing list