-
Create a new file called footer.php in /libraries/joomla/document/html/renderer/ directory:
-
In /libraries/joomla/document/document.php add after
public $_scripts = array();
this
public $_footer_scripts = array();
-
Add method addFooterScript() after the addScript() method
function addFooterScript($url, $type = "text/javascript", $defer = false, $async = false) { $this->_footer_scripts[$url]['mime'] = $type; $this->_footer_scripts[$url]['defer'] = $defer; $this->_footer_scripts[$url]['async'] = $async; return $this; }
-
In index.php in you template folder add just before the tag
<jdoc:include type="footer" />
-
Done!
Now in layouts inside your template's folder you can use the following code to add javascript files to footer:$doc =& JFactory::getDocument(); $doc->addFooterScript('JavaScript_File_Path.js');
TODO : check for updates...