Last modified: 2006-06-05 15:59:18 UTC
The ability to add javascripts in the <head> tags. When creating a extension, enabling this feature would be very helpfull to dev's.
Would this be accepting JavaScript as a parameter (to be slapped between <script> tags), the path to a .js file, or both?
I would say both so it can please a wider range of people (two different calls). Personaly, the path to a script file would be fine. I've noticed $wgOut->addScript() but it seams to do nothing when a page is rendered. You can hold info with it and check that info $wgOut->getScript() but it out-puts nothing.
I'll look into it and either tweak how the existing functions work, or add something else.
Sounds good. Right now its not a big deal being the extention is in the begining stages, i just edited the MonoBook.php file, but in the past while making forum mods & add-ons i always tried to do the least amount of editing to the orginal files as possable. Thanks for the responce.
This should be done via hooks, not by adding a custom function that duplicates what we have in the codebase already for cases like these.
(In reply to comment #5) > This should be done via hooks, not by adding a custom function that duplicates > what we have in the codebase already for cases like these. I hadn't even gotten round to doing it yet. If you want to, go ahead and implement it with hooks.
Forgotten about ?
I ran into this, and Google landed me here. In short, none of the default templates use SkinTemplate::html to get the 'headscripts' data element that is populated from OutputPage::getScript(). To get the data you shoved into OutputPage::addScript(), add the following to a template in the 'right' place: <?php $this->html('headscripts') ?> Perhaps that should be another bug entry...
MediaWiki 1.6+ contains OutputPage::addScript() and it works. Closing FIXED.