$wgParser->setHook('foo', 'bar') says to call function bar() when you see the tag <foo>. Is there a way to tell setHook to pass parameters to bar()? That is, when the parser sees tag <foo>, it should call bar('a', 'b', 'c')?
DanB
setHook already passes an array $argv into your function bar() which contains XML-style attributes from your tag. That seems like the obvious way to pass parameters. http://www.mediawiki.org/wiki/Manual:Tag_extensions You define your function like ...
function bar( $in, $argv, &$parser ) { # $input is the text between the tags. # $argv is an array containing any arguments passed to the # extension like <example arg1="foo" bar baz>. # $parser is the parent parser. }
Or you could evaluate global variables inside bar(). Or you could have setHook call baz() which sets the parameters and then calls bar() ...
HTH, Boris
On 16-Nov-07, at 12:24 PM, Daniel Barrett wrote:
$wgParser->setHook('foo', 'bar') says to call function bar() when you see the tag <foo>. Is there a way to tell setHook to pass parameters to bar()? That is, when the parser sees tag <foo>, it should call bar ('a', 'b', 'c')?
DanB _______________________________________________ MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org