Home Joomla! Tip of the Day Remove mootools.js included in Joomla by default

Boomark this article

Add to: Digg Add to: Del.icoi.us Add to: Reddit Add to: StumbleUpon
Remove mootools.js included in Joomla by default
User Rating: / 23
PoorBest 
Tuesday, 05 August 2008 15:06

In most cases it is not necessary to have mootools.js framework included in every Joomla! page since this affects performance and can raise conflits when you will try to use next version of mootools framework in one of your components (for example mootools 1.11 and mootools 1.2 are NOT fully compatible). In this case it is useful to remove mootools from Joomla header and add it only when needed.

Go to Extensions->Template Manager in the administration, select the template and click “Edit”, then click “Edit HTML”. Before the closing “</head>” tag add the following strings:

<?php  
  $headerstuff = $this->getHeadData();  
  $scripts = $headerstuff['scripts'];
  foreach ($scripts as $path => $val)
  {
    if (strpos($path, 'mootools.js') !== false || strpos($path, 'caption.js') !== false) unset($scripts[$path]);
  }
  $headerstuff['scripts'] = $scripts;
  $this->setHeadData($headerstuff);  
?>

<jdoc:include type="head" />

This code will remove all pre-included JS files - for Joomla 1.5 they are mootools.js and caption.js.

 

Joomla Tip of the day articles.

(c) 2008 ARI Soft. This article or quotations from it may be used only by ARI Soft approbation.

 
Copyright © 2012 ARI Soft Joomla! extensions - Joomla! 1.5 demo. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.