PAGE Methods
Including templates and objects
content(), module(), object()Request content via AJAX
collect(), complete(), elements(), element()Insert code (CSS, JS, HTML)
style(), script(), meta(), bottom(), tracking()Template data
directory(), views(), details(), preview(), charset(), language(), error()Reading and writing META data
title(), topic(), descr(), claim(), robots(), keywords()HTTP header
mime(), status(), expires(), header(), download()
script()
Add Javascript to page header. This function can be called from anywhere inside any template. If you place the exact same code in a content template, the code will only be added once, even if the template is shown several times on that page.
null script( string code )
Return
The function will not return any value, it just inserts the Javascript code into the page's header section.
Parameter
Description
codeJavascript code.
Add jquery code to page header
$PAGE->script('$(function(){$("h3").addClass("green");});')
RETURN: ''