Box\Brainy\Templates\Template::__construct PHP Method

__construct() public method

Some of the global Smarty settings copied to template scope It load the required template resources and cacher plugins
public __construct ( string $tplResource, Box\Brainy\Brainy $brainy, Template $parent = null, mixed $compileID = null, boolean | void $suppressData = false )
$tplResource string template resource string
$brainy Box\Brainy\Brainy Brainy instance
$parent Template back pointer to parent object with variables or null
$compileID mixed compile id or null
$suppressData boolean | void Prevents data from being copied into the variable scope
    public function __construct($tplResource, $brainy, $parent = null, $compileID = null, $suppressData = false)
    {
        if ($parent === null || !$suppressData) {
            parent::__construct($brainy);
        } else {
            // Copied from the TemplateBase constructor
            $this->smarty = $brainy;
        }
        $this->compile_id = $compileID ?: $this->smarty->compile_id;
        $this->parent = $parent;
        // Template resource
        $this->template_resource = $tplResource;
        $this->smarty->fetchedTemplate($tplResource);
        $this->source = \Box\Brainy\Resources\Resource::source($this, $brainy, $this->template_resource);
        $this->compiled = $this->source->getCompiled($this);
        if (!$suppressData && $this->parent) {
            if (is_array($this->parent)) {
                $this->applyDataFrom($this->parent, false);
            } else {
                $this->cloneDataFrom($this->parent, false);
            }
        }
    }