/** * @desc Builds a FileTemplate object * @param string $file_identifier The identifier of the file you want to load (see this class' description) * to know how to compose a indentifier. */ public function __construct($file_identifier) { $this->file_identifier = $file_identifier; $data = new DefaultTemplateData(); $data->auto_load_frequent_vars(); $loader = new FileTemplateLoader($this->file_identifier, $data); $renderer = new DefaultTemplateRenderer(); parent::__construct($loader, $renderer, $data); }
/** * @desc Constructs a StringTemplate * @param string $content The content of the template (a string containing PHPBoost's template engine syntax). * @param bool $use_cache Controls if it has or not to use cache * @param bool $auto_load_vars Tells whether it has to load or not the most common variables. */ public function __construct($content, $use_cache = self::USE_CACHE_IF_FASTER) { $data = new DefaultTemplateData(); $data->auto_load_frequent_vars(); $renderer = new DefaultTemplateRenderer(); if ($this->has_to_cache($content, $use_cache)) { $loader = new CachedStringTemplateLoader($content); } else { $loader = new StringTemplateLoader($content); } parent::__construct($loader, $renderer, $data); }