Creates a script tag to load a javascript file
<?php echo js('assets/js/site.js') ?>
<?php echo js(array(
'assets/js/jquery.js',
'assets/js/jquery.ui.js',
'assets/js/site.js',
)) ?>
<?php echo js('@auto') ?>
Template specific js files must be located in /assets/js/templates
and named like the template.
Template | JS file |
---|---|
/site/templates/project.php | /assets/js/templates/project.js |
/site/templates/home.php | /assets/js/templates/home.js |
/site/templates/blog.php | /assets/js/templates/blog.js |
If you want the js files to be loaded asynchronously (if supported by the browser), you can set a second parameter as true:
<?php echo js('assets/js/site.js', true) ?>