[Mediawiki-l] Adding Scripts to a Page

Richard Minerich richard.minerich at gmail.com
Fri Jun 2 21:15:52 UTC 2006


That is quite strange. In the docs for making "special pages" they talk
about using $wgOut directly and using addHTML. I guess that is a completely
different case though. So is it possible to sneak scripts into the head
another way?

On 6/2/06, Brion Vibber <brion at pobox.com> wrote:
>
> Richard Minerich wrote:
> > I am currently working on an extension for MediaWiki and am having some
> > trouble getting scripts into the <head>
> > it seems as though $wgOut->addScript() does not work in the following
> case:
> [snip]
> > I am unsure if it is because the timing of when I call addScript or
> what.
> > Any help would be greatly appreciated.
>
> You may not touch $wgOut or its output at wikitext render time (when
> parser hook
> extensions are called). First, output is also aggressively cached  so your
> hook
> will usually not be run again at actual output time.
>
> Keep in mind also that rendering may happen as a background task *while
> something else is being displayed*, or in a maintenance script, etc. By
> touching
> $wgOut directly you may be corrupting the display of another page.
>
> I've got an experimental hack for attaching additional extension hooks to
> run at
> display time which can be set from a paser hook; see
> http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/Aggregator/
>
> This work is incomplete at this time.
>
> -- brion vibber (brion @ pobox.com)
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l at Wikimedia.org
> http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
>



More information about the MediaWiki-l mailing list