Thanks, Jamie. This seems to work for things like {{PAGENAME}}, but
so does $wgParser->replaceVariables($text). Neither function call
pulls in values for triple brace parameters. Right now all I really
need is the PAGENAME of the page being rendered, so this works for me.
Con
On Sep 17, 2005, at 2:25 PM, Jamie Bliss wrote:
Con Rodi wrote:
Love extensions! Hate what they do to wiki code,
but they are
very useful. Thanks to those who made this feature possible.
How can I get the value of a template's parameters while in an
extension? I'm talking about an extension that is invoked in a
template that has parameters. For example, <extension>{{{1}}}</
extension> somewhere in a template. The text '{{{1}}}' is passed
to the extension rather than it's value. It's clear the the
parser doesn't parse wiki text before nor after an extension is
called, probably by design. That seems to leave this issue to
the extension writer. Is there a way to get to such a
parameter's value or somehow pass that value to an extension?
The way I did it was this:
$wgParser->replaceVariables($text, end( $wgParser->mArgStack ))
Note that I last tested this on 1.5, a few revisions back. This
also only works on the main text input (*not* <foo bar=baz>
arguments).
-- Jamie
-------------------------------------------------------------------
http://endeavour.zapto.org/astro73/
Thank you to JosephM for inviting me to Gmail!
Have lots of invites. Gmail now has 2GB.
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l(a)Wikimedia.org
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l