Application Framework Reference

Template Utilities API

add_script_block()

The add_script_block() method is a convenience expression that wraps the script_tags() template utility, which includes the contents of the caller body within a script block. This method is used by consumers to include template-specific JavaScript on template render.

Warning: Never inject user input into a call to add_script_block().

Synopsis

add_script_block()

Example

%page args="h"/><%namespace name="lib" file="//lib.html" import="*"/>

<%call expr="lib.add_script_block()">
    alert('This alert will be included within a script block in this template');
</%call>
 

See Also

script_tags()