Registers a JS code block.
public registerJs ( string $js, integer $position = self::POS_READY, string $key = null ) | ||
$js | string | the JS code block to be registered |
$position | integer | the position at which the JS script tag should be inserted in a page. The possible values are: - [[POS_HEAD]]: in the head section - [[POS_BEGIN]]: at the beginning of the body section - [[POS_END]]: at the end of the body section - [[POS_LOAD]]: enclosed within jQuery(window).load(). Note that by using this position, the method will automatically register the jQuery js file. - [[POS_READY]]: enclosed within jQuery(document).ready(). This is the default value. Note that by using this position, the method will automatically register the jQuery js file. |
$key | string | the key that identifies the JS code block. If null, it will use $js as the key. If two JS code blocks are registered with the same key, the latter will overwrite the former. |