コード例 #1
0
ファイル: Smarty.php プロジェクト: maps82/smarty-view
 /**
  * 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);
 }