Beispiel #1
0
 public function __construct($templateName)
 {
     if (substr($templateName, 0, 1) != '/') {
         $templatePath = ROOT . DS . 'app' . DS . 'views' . DS . $templateName;
     } else {
         $templatePath = $templateName;
     }
     if (!file_exists($templatePath)) {
         throw new ViewException('Template file ' . $templatePath . ' does not exist');
     }
     parent::__construct($templateName);
 }
Beispiel #2
0
 public function __construct($templateName)
 {
     $this->_smarty = new \Smarty();
     // The smarty instance should be accessible before
     $smartyDir = ROOT . DS . 'app' . DS . 'views' . DS . 'smarty' . DS;
     $this->_smarty->template_dir = $smartyDir . 'templates' . DS;
     $this->_smarty->compile_dir = $smartyDir . 'compiled_templates' . DS;
     $this->_smarty->config_dir = $smartyDir . 'configs' . DS;
     $this->_smarty->cache_dir = $smartyDir . 'cache' . DS;
     $templatePath = ROOT . DS . 'app' . DS . 'views' . DS . 'smarty' . DS . 'templates' . DS . $templateName;
     if (!file_exists($templatePath)) {
         throw new \pff\ViewException('Template file ' . $templatePath . ' does not exist');
     }
     parent::__construct($templateName);
     $this->_smarty->registerPlugin('function', 'renderAction', array($this, 'smarty_plugin_renderAction'));
 }