jeffchannell.com

Always Load Mootools in a Joomla! Template

Posted in Joomla!
2009-04-04 16:32:18 +0000 UTC

When working on a template, sometimes you want to use Mootools to do some nifty effects. For example, here on my site I have Mootools doing some hover animations on the left navigation. This works well on content pages, but some pages don't load Mootools by default, like the search results page. To get Mootools to load no matter what page is showing, add this tag to the <head> section of the template, right after the jdoc header include:

<?php JHTML::_('behavior.mootools'); ?>

This method is preferred over statically adding a <script> tag, because if Mootools is already being added as part of the jdoc header include, it doesn't re-add the tag in your html source.