[Pmwiki-users] Dev Tip: Function Pointers

Steven Leite steven_leite
Mon Mar 22 18:18:56 CST 2004


A good way to return function data to $SquareBrackets[..]= is by setting the script's function to be stored in a $variable as an address (thanks to Dave for explaining that one to me).

Example:

$my_func = & MyFunction( );
$SquareBrackets["[[hook:]]"] = $my_func;

This means the function won't get executed every time PmWiki is executed, but instead, only when [[hook:]] is actually encountered.  

To build on that idea I have a question:

Q:  Is it possible to do something similar when the [[hook:]] contains a back-reference from a regexp?

Example:

$SquareBrackets["[[regexp]]"] = MyFunction($1);
..
function MyFunction($str) { 
// do something with $str
  return $some_output;
}

Thanks,

-S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://contra.vosn.net/pipermail/pmwiki-users_pmichaud.com/attachments/20040323/e331ead3/attachment.htm


More information about the pmwiki-users mailing list