381
How to: Remove the Mootools code from Joomla
29. June 2009

I’m currently busy with building a website for a local culture event. In the past I’ve made other websites for this customer, and they are all running on Joomla. Because the customer now knows how to work with this software I decided to use it for this website as well. I’m using jQuery and Thickbox to show the pages within the website on a dynamic way, but there happened to be a problem with this.

Joomla automatically adds the Mootools code to the header of the template, which conflicts with the jQuery code I added myself. The Thickbox script didn’t work at all so I had to find a solution. After a quick Google search I found a lot of forum posts, where other designers had the same problem. Unfortunately none of the forums offered a quick solution. I tried to disable the Mootools code in Joomla’s behavior.php, but this is a site-wide change and also affects the Adminstration. It seems that Mootools is necessary for Joomla to run, at least for the Administration of the website.

Later I found the solution and it is quite easy. Just add the following code to the head section of your template’s index.php, and the Mootools code will be removed:

<?php
// Remove auto generated mootool from header
$headerstuff = $this->getHeadData();
reset($headerstuff['scripts']);
$moo = key($headerstuff['scripts']);
unset($headerstuff['scripts'][$moo]);
$this->setHeadData($headerstuff);
?>
<jdoc:include type="head">
Digg Delicious Stumble Upon Reddit Twitter Subscribe by RSS Subscribe by Email

Leave a comment