/** * Load smarty3 * @param mixed $params * @return Smarty3 */ static function _init_smarty3($params) { $smarty = false; // check smarty autoload $status = class_exists('Smarty'); $file = loader::get_public() . loader::DIR_EXT . 'smarty3/Smarty.php'; if (!file_exists($file)) { throw new lib_exception('Smarty3 file not found'); } require $file; if (!class_exists('Smarty3', false)) { throw new lib_exception('Smarty3 class not found'); } $smarty = new Smarty3(); $smarty->debugging = isset($params['debugging']) ? $params['debugging'] : core::selfie()->cfg('debug_templates', false); $smarty->caching = isset($params['caching']) ? $params['caching'] : false; $smarty->cache_lifetime = isset($params['cache_lifetime']) ? $params['cache_lifetime'] : 120; $smarty->cache_locking = true; $smarty->compile_check = isset($params['compile_check']) ? $params['compile_check'] : true; $smarty->force_compile = isset($params['force_compile']) ? $params['force_compile'] : false; $smarty->merge_compiled_includes = false; $smarty->error_reporting = error_reporting() & ~E_NOTICE; $smarty->addPluginsDir(loader::get_public() . loader::DIR_EXT . 'smarty3/plugins'); // add asset compiler plugin $smarty->addPluginsDir(loader::get_public(loader::DIR_EXT . 'smarty-sacy')); core::dprint(array('[smarty3] dist:%s %s debugging: %s, caching: %s, force: %s, ttl: %d', $status ? 'composer' : 'old', Smarty3::SMARTY_VERSION, $smarty->debugging ? 'yes' : 'no', $smarty->caching ? 'yes' : 'no', $smarty->force_compile ? 'yes' : 'no', $smarty->cache_lifetime), core::E_RENDER); $template = core::selfie()->cfg('template'); self::$parser = $smarty; self::set_template($template); return $smarty; }
public function renderTemplate() { $smarty = new Smarty3(); $smarty->assign("Exception", $this->exception); $smarty->assign("Dev", $this->dev); $smarty->assign("Lines", $this->getLines()); $html = $smarty->fetch($this->template); return $html; }