To keep upwards compatibility for your Joomla Core the following example shows a solution, by clearing the Header Buffer from the scripts Joomla is adding by itself. This is a template based modification, which does work with extensions loading their own Scripts or Stylesheets into the Header Buffer. And by that also transparent and not affected by any version upgrade to your Joomla Core:
<!-- Load MooTools by the template, and at the top before any other scripts --> <?php /* --- This removes any Joomla default Scripts from the Header Buffer --- */ $header = $this->getHeadData(); // Get the current HEAD buffer $header['scripts'] = array(); // Clear all current 'scripts' entries $this->setHeadData($header); // Update the HEAD buffer /* --- We add the MooTools Framework manually, see below --- */ ?> <head> <!-- Load MooTools at first --> <script type="text/javascript" src="templates/<?php echo $this->template ?>/js/mootools/mootools-1.2.1-core.js"></script> <script type="text/javascript" src="templates/<?php echo $this->template ?>/js/mootools/mootools-1.2-more.js"></script> <script type="text/javascript" src="templates/<?php echo $this->template ?>/js/mootools/mootools-1.2-compat.js"></script> <!-- Now all other scripts from extensions --> <jdoc:include type="head" /> </head>
I founded better way to remove base MooTools library, replace top < ?php ... ?> with:
< ?php
// no direct access
defined('_JEXEC') or die('Restricted access');
$template_baseurl = $this->baseurl . ‘/templates/’ . $this->template;
$header = $this->getHeadData();
unset ($header['scripts'][$this->baseurl . '/media/system/js/mootools.js']);
$this->setHeadData($header);
?>
Fragov;
I would like to thank you for this wonderful “life saving” script. My issue with method 1 was: When I tried it in my template, the template loaded Mootools scripts in the header loop from my custom location (templates/scripts/mootools.js), and all my plugins are using Joomla Mootools (/media/system/js/mootools.js)
I wanted to “unset” my custom location, cause it was breaking my clients website (Kickstreet.com)
I modified the script and now, in the Header Loop it unsets my custom Mootools so pages load with only one version, clearing all my joomla page erors, see below:
—————————————
getHeadData(); // Get the current HEAD buffer
unset($header['scripts'][$this->baseurl . '/scripts/mootools.js']); // Clear templates custom MooTools
$this->setHeadData($header); // Update the HEAD buffer
?>
————————————-
DELETE ALL THIS ALSO!!!!!!!!!
————————————-
#
# <script type="text/javascript" src="templates/template ?>/js/mootools/mootools-1.2.1-core.js”>
# <script type="text/javascript" src="templates/template ?>/js/mootools/mootools-1.2-more.js”>
# <script type="text/javascript" src="templates/template ?>/js/mootools/mootools-1.2-compat.js”>
————————————-
Hope that helps..