How can I use MooTools 1.2 in Joomla 1.5?

Even recent Joomla 1.5.x uses MooTools 1.1 which is old and incompatible with some modern MooTools-based scripts. I hope Joomla 1.6 will use MooTools 1.2 – but right now we are forced to use the old version.

How can we use the new MooTools 1.2 series and core Joomla MooTools loader JHTML::_(‘behavior.mootools’) without patching core files?

Easy!

Save the MooTools 1.2 series .js file somewhere in your template, i.e. /templates/mytemplate/js/mootools12.js and add following files at the top of your template’s index.php:

unset($this->_scripts['/media/system/js/mootools.js']);
$this->_scripts = array_merge(array('/templates/mytemplate/js/mootools12.js' => 'text/javascript'), $doc->_scripts);

Now you can include MooTools in your extensions as usual:

JHTML::_('behavior.mootools');

But frontend will load your 1.2 version.

Source: http://blogomunity.com/joomla-blog/58-how-can-i-use-mootools-12-in-joomla-15.html

Related Articles