The display_js() helper function prints HTML script
tags to the page for each script added with queue_js(). It is commonly used in a theme's common/header.php file to print the script
tags inside the page head
.
display_js() will also include Omeka's "default" JavaScript files.
Usage
<?php display_js($includeDefaults = true); ?>
Arguments
- $includeDefaults (boolean) (optional) (default: true) Whether or not to include Omeka's default scripts in the output. By default, the scripts will be included.
Return Value
None. display_js() prints the tags immediately, it does not return them as a string.
Example(s)
Standard Usage
In a theme's common/header.php:
<?php display_js(); ?>
This will print a tag for any script added with queue_js(), as well as Omeka's default scripts. In a theme, the call to display_js() should come after the call to plugin_header() so plugins have a chance to add their own JavaScript.
Exclude Default Scripts
<?php display_js(false); ?>
Adding the false parameter to display_js() causes it to only print tags for scripts specifically added with queue_js(). You may wish to do this on specific pages you know do not need Omeka's default scripts, or to avoid conflicts with custom JavaScript.
Note: it is not recommended to use this form of display_js() in a theme's common/header.php. This will exclude the default scripts from all pages, and will likely cause Omeka and many plugins to malfunction.
Source File / Version
- application/helpers/AssetFunctions.php in Omeka 1.3.