/** * Create template data object * * Some of the global Smarty settings copied to template scope * It load the required template resources and cacher plugins * * @param string $tplResource template resource string * @param Brainy $brainy Brainy instance * @param Template $parent back pointer to parent object with variables or null * @param mixed $compileID compile id or null * @param bool|void $suppressData 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); } } }