You can use JHTML::script() to include a script declaration between the <head> and </head> tags of a Joomla! generated page.
This is useful for modules or components that need custom scripts to work.
Syntax
JHTML::script(file, path, mootools);
- file script file name
- path path to the folder where script is located. It can be absolute or relative to Joomla! folder
- mootools if true Mootools framework will be loaded.
Example
Let's say you are developing a module called mod_mymodule and you want to add a declaration for a script myscript.js located in [Joomla! folder]/modules/mod_mymodule/js, here is the code you need to use
JHTML::script('myscript.js','modules/mod_mymodule/js/');When, as in this example, path doesn't start with http:// it's considered relative to Joomla! folder.






