/** * Create new Smarty view * * @param string|array $paths Paths to templates directories * @param array $settings Smarty settings */ public function __construct($paths, $settings = []) { $this->smarty = new \Smarty(); $this->smarty->setTemplateDir($paths); if (isset($settings['cacheDir'])) { $this->smarty->setCacheDir($settings['cacheDir']); } if (isset($settings['compileDir'])) { $this->smarty->setCompileDir($settings['compileDir']); } if (isset($settings['pluginsDir'])) { $this->smarty->setPluginsDir($settings['pluginsDir']); } }
/** * Create new Smarty view * * @param string $path Path to templates directory * @param array $settings Smarty settings */ public function __construct($path, $settings = []) { $this->smarty = new \Smarty(); $this->smarty->setTemplateDir($path); if (isset($settings['compile'])) { $this->smarty->setCompileDir($settings['compile']); } if (isset($settings['config'])) { $this->smarty->setConfigDir($settings['config']); } if (isset($settings['cache'])) { $this->smarty->setCaching(\Smarty::CACHING_LIFETIME_CURRENT); $this->smarty->setCacheDir($settings['cache']); } $this->smarty->setDebugging(isset($settings['debug']) ? $settings['debug'] : true); }
public function __construct($config = array()) { if (!$this->smartyInstance instanceof \Smarty) { if (!class_exists('\\Smarty')) { if (!empty($config['smartyDir']) && !is_dir($config['smartyDir'])) { throw new \RuntimeException('Cannot set the Smarty lib directory : ' . $config['smartyDir'] . '. Directory does not exist.'); } } $this->smartyInstance = new \Smarty(); if (!empty($config['templateDir'])) { $this->smartyInstance->setTemplateDir($config['templateDir']); } if (!empty($config['cacheDir'])) { $this->smartyInstance->setCacheDir($config['cacheDir']); } if (!empty($config['compileDir'])) { $this->smartyInstance->setCompileDir($config['compileDir']); } if (!empty($config['configDir'])) { $this->smartyInstance->setConfigDir($config['configDir']); } if (!empty($config['caching'])) { $this->smartyInstance->caching = $config['caching']; } if (!empty($config['compile_check'])) { $this->smartyInstance->compile_check = $config['compile_check']; } if (!empty($config['cache_lifetime'])) { $this->smartyInstance->cache_lifetime = $config['cache_lifetime']; } if (!empty($config['debugging'])) { $this->smartyInstance->debugging = $config['debugging']; } if (!empty($config['left_delimiter'])) { $this->smartyInstance->left_delimiter = $config['left_delimiter']; } if (!empty($config['right_delimiter'])) { $this->smartyInstance->right_delimiter = $config['right_delimiter']; } } }