Example #1
0
 /**
  * Returns the cached smarty instance or creates and caches a new instance
  *
  * Not every Slim route will use Smarty, so by implementing this function,
  * we save those routes from having unnecessary overhead.
  *
  * @return \Smarty
  */
 protected function getSmartyInstance()
 {
     if ($this->smarty) {
         return $this->smarty;
     }
     $smarty = new \Smarty();
     $smarty->setTemplateDir($this->template_dir);
     $smarty->setCompileDir($this->compile_dir);
     $smarty->setCacheDir($this->cache_dir);
     $smarty->setErrorReporting(0);
     if ($this->plugin_dir) {
         $smarty->addPluginsDir($this->plugin_dir);
     }
     return $this->smarty = $smarty;
 }