Anthony McLin

Using MooTools 1.2 in Joomla

MooTools is on version 1.2.3 (after completely dropping 1.1.1 as the default about a year ago), and version 2.0 is expected before years' end. Joomla however, still is including 1.1.1 because of compatibility issues with various plugins. People have been asking how to safely replace the version of MooTools included. Since I've done this several times, I figured I'd share my method here.

My first piece of advice is don't try to replace MooTools for the administrator interface. You're likely to just break all admin functionality. My second bit of advice is that if you rely on MooTools for specific plugins (like video players or enhanced menu systems), then don't do this. Again you're very likely to break things and it can be a real hassle to rewrite other people's plugins to work the way you want them to.

Since I do a lot of custom template work, and my clients usually only have the plugins I setup for them, I found that the best solution for me was to handle this from within my custom templates. This way, I don't need to modify any core files (making this a relatively future-proof technique) and I also have more control as to how it behaves.

  1. First drop your MooTools 1.2 files into a folder within your custom template. I like to use a folder called js for my template javascript.
  2. Make sure that MooTools 1.1.1 is not being included when your template is rendered. Make sure to do this somewhere before <jdoc:include type="head" />
    //Drop the built in mootools script
    unset($this->_scripts[$this->baseurl .'/media/system/js/mootools.js']);
    //Drop the built in captions script
    unset($this->_scripts[$this->baseurl .'/media/system/js/caption.js']); 
  3. Next, add your MooTools 1.2 files either by listing them in the head as you would with any HTML file, or by using Joomla's addScript() method. I prefer the latter:
    $this->addScript(JURI::base() . 'templates/' . $this->template
         .  '/js/mootools-1.2.js');
    $this->addScript(JURI::base() . 'templates/' . $this->template
         . '/js/mootools-1.2-more.js');
That's it! Now the frontend of your site will not load Joomla's version of MooTools 1.1.1, and instead will load your version of MooTools 1.2. Of course make sure the filenames and paths are correct, and you should be good to go!


Alex, you are partially correct. It should be noted that my method here is for Joomla 1.5.0 - 1.5.18. If you have implemented my method, and then upgraded your site to Joomla 1.5.20, you should try removing this code and turning on the new Mootools Upgrade Plugin.

However Alex, you are wrong about Mootools 1.2.4 not being included in upgrade installs. It is provided, just not enabled. There's no need to go through extra steps to download and install the plugin. Once you've upgraded to Joomla 1.5.20, simply go to the Plugins Manager and publish the Mootools 1.2.4 Upgrade that is already included.

Thx for the reply.

I actually went through the update process couple of days ago, just because of the Mootools 1.2 plug-in.

You are absolutely right, the plug-in is included in the Joomla Patch for the update. However the patch handles only updated files (php files), and for the plug-in to be present in the back-end it needs database record. The Download and Installation of plug-in makes it easier to add it to database, through a reinstall process. It is also possible to add the database record on it's own without re-installation (Solution #1 in the article)

Actually Alex I had no problem just enabling the plugin on sites that I've tested the update on. Check to make sure you're using Joomla 1.5.20, as 1.5.19 was a messed up installation that was quickly replaced.

Hmmm... that's great that it worked for you after update. Kind of intriguing... did you use patch update?

Great post, this is very clean and manageable without hacking any core which is just what I wanted to do!

in Joomla 1.5.19 there is a Plugin called "System - Mootools Upgrade" activate it and you have upgraded your Mootools to 1.2.4 with compatibility


You're absolutely right sk8connection, this post was specifically before Joomla 1.5.19. My followup article after Joomla 1.5.19 was released discusses this:

- Anthony McLin

- Anthony McLin

Add new comment