CI_Javascript::compile PHP Method

compile() public method

gather together all script needing to be output
public compile ( string $view_var = 'script_foot', boolean $script_tags = TRUE ) : string
$view_var string
$script_tags boolean
return string
    public function compile($view_var = 'script_foot', $script_tags = TRUE)
    {
        $this->js->_compile($view_var, $script_tags);
    }

Usage Example

Example #1
0
    /**
     * Extending the compile function to add the globals
     *
     * @access	public
     */
    function compile($view_var = 'script_foot', $script_tags = TRUE)
    {
        parent::compile($view_var, $script_tags);
        $global_js = $this->inline('
			document.documentElement.className += "js";

			var EE = ' . json_encode($this->global_vars) . ';

			if (typeof console === "undefined" || ! console.log) {
				console = { log: function() { return false; }};
			}
		');
        $this->CI->view->cp_global_js = $global_js;
    }
All Usage Examples Of CI_Javascript::compile