[pmwiki-devel] markup() callback fn and $pagename
Petko Yotov
5ko at 5ko.fr
Mon Feb 24 08:05:07 CST 2014
V.Krishn writes:
> I am trying to use a callback as in example here,
> http://www.pmwiki.org/wiki/PmWiki/CustomMarkup#php55
> installation: Php-5.5.4, pmwiki-2.2.57
Please use the latest version if you can. The documentation should be
supposed to apply to the latest version, also some bugs may have already
been fixed.
> 1 using,
> extract($GLOBALS["MarkupToHTML"]); # to get $pagename
>
> gives the following error:
> PHP Warning: extract() expects parameter 1 to be array, null given in
Sorry, you need to have at least 2.2.58 to use $GLOBALS["MarkupToHTML"].
I'll add it to the documentation.
But if you can, upgrade to the latest version and not to 2.2.58.
> Which of the two conversion methods
> described here 'PmWiki/CustomMarkup#php55' is recommended
>
> in simple replacements code like,
> "functionName(\$pagename, PSS('$1'))" ?
If your function doesn't use $pagename:
Markup('name', 'where', 'pattern', 'functionName');
function functionName($m) { } # '$1' is now $m[1], no need for PSS()
If your function uses $pagename, either the above with the extract() line,
or this:
Markup_e('name', 'where', 'pattern', "functionName(\$pagename, \$m[1])");
Petko
More information about the pmwiki-devel
mailing list