head_js — Get the JavaScript tags that will be used on the page.¶
Summary¶
The head_js() helper function prints HTML script tags to the page for each script added with queue_js_file. It is commonly used in a theme’s common/header.php file to print the script tags inside the page head.
head_js() will also include Omeka’s “default” JavaScript files.
- head_js($includeDefaults = true)¶
Get the JavaScript tags that will be used on the page.
This should generally be used with echo to print the scripts in the page head.
Parameters: - $includeDefaults (bool) – Whether the default javascripts should be included. Defaults to true.
Returns: string
Usage¶
Examples¶
Use after all desired javascript files, urls, and strings have been queued to add the javascript information to the page head.
<?php
queue_js_file(array('my_js_file', 'another_js_file'));
queue_js_url('//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js');
queue_js_string("
window.addEventListener('load', function() {
FastClick.attach(document.body);
}, false);
");
?>
<?php head_js(); ?>