Capsule::display PHP Method

display() public method

Low overhead (no output buffering) method to simply dump template to buffer.
public display ( string $__template ) : void
$__template string
return void
    function display($__template)
    {
        // Prepend "private" variable names with $__ in this function
        // to keep namespace conflict potential to a minimum.
        // Alias this class to $generator.
        $generator = $this;
        if (isset($this->vars['this'])) {
            throw new Exception("Assigning a variable named \$this to a context conflicts with class namespace.");
        }
        // extract variables into local namespace
        extract($this->vars);
        // prepend template path to include path,
        // so that include "path/relative/to/templates"; can be used within templates
        $__old_inc_path = ini_get('include_path');
        ini_set('include_path', $this->templatePath . PATH_SEPARATOR . $__old_inc_path);
        @ini_set('track_errors', true);
        include $__template;
        @ini_restore('track_errors');
        // restore the include path
        ini_set('include_path', $__old_inc_path);
        if (!empty($php_errormsg)) {
            throw new Exception("Unable to parse template " . $__template . ": " . $php_errormsg);
        }
    }