Disabling Joomla Template js Files
By default, Joomla 1.5 includes the same JavaScript files within any templates it renders (public facing or internal admin). This can be useful, but sometimes you don’t want to have the same js files included in both… public and admin versions of your site. For example, One of the default Joomla included js files is MooTools, a pretty nice OO JavaScript framework. If you wanted to use say Prototype instead of MootTools, you will more than likely run into conflicts with both JavaScript libraries included in your template. Within public facing templates, it is sometimes necessary to disable the Joomla included js files … but how?
I’ve run into this type of conflict specifically between MooTools and Prototype, when using IE 6. Luckily, there is a fairly easy way to disable Joomla included js files from your public facing template. Within your templates index.php (or equivalent), add the following:
$user =& JFactory::getUser();
if ($user->get('guest') == 1) {
$headData = $this->getHeadData();
$headData['scripts'] = array();
$this->setHeadData($headData);
}
h u g h
7thgroove
No comments
Jump to comment form | comments rss [?] | trackback uri [?]