Example #1
0
File: Twig.php Project: h1soft/h
 public function __construct()
 {
     $this->setViewPath(\hmvc\Web\Application::themesPath());
     $this->setTheme(\hmvc\Web\Config::get('view.theme'));
     $this->tplFullPath = $this->getViewPath() . \hmvc\Web\Config::get('view.theme', 'default') . '/';
     if (\hmvc\Web\Config::get('view.cache', false) === false) {
         $this->cachePath = false;
     } else {
         $this->cachePath = \hmvc\Web\Application::varPath() . 'cache/';
     }
     if (!isset($this->_loader)) {
         \Twig_Autoloader::register();
         $this->_loader = new \Twig_Loader_Filesystem($this->tplFullPath);
         $this->_twigEnv = new \Twig_Environment($this->_loader, array('cache' => $this->cachePath));
         $this->initFunctions();
     }
 }