I'm trying to add an HTML header from a MediaWiki extension using $wgOut->addScript(), but nothing is included in the output page.
Adding things after the <body> element does work fine, eg. using addHTML(), so it seems the extensions can't currently modify the HTML header parts.
Is this assumption correct, or am I doing something wrong here?
Thanks,
Jama Poulsen http://wikicompany.org
Jama Poulsen wrote:
I'm trying to add an HTML header from a MediaWiki extension using $wgOut->addScript(), but nothing is included in the output page.
Adding things after the <body> element does work fine, eg. using addHTML(), so it seems the extensions can't currently modify the HTML header parts.
Is this assumption correct, or am I doing something wrong here?
Parser extensions take input: * text within the open and close tags * attribute parameters on the open tag (in 1.5)
and create output: * HTML fragment
They do not know anything about the page they're on, nor have any contact with the HTTP headers or the output template. Since parser output is cached, your extension isn't even necessarily run when a page is displayed.
Anything outside that in a parser extension is not supported; 'cheating' will surprise the system and may break.
If you're making a special-page extension you can of course manipulate $wgOut all you like, or disable it and construct your output completely as you wish.
-- brion vibber (brion @ pobox.com)
wikitech-l@lists.wikimedia.org