PAGE Methods

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: ''