Example #1
0
 /**
  * Sandbox method to evaluate a template / view script in.
  *
  * @param string $viewFn Filename of the view
  * @param array $dataForView Data to include in rendered view.
  *    If empty the current View::$viewVars will be used.
  * @return string Rendered output
  */
 protected function _evaluate($viewFile, $dataForView)
 {
     if (!preg_match('/(?:\\.zpt|\\.xhtml|\\.html)$/', $viewFile)) {
         return parent::_evaluate($viewFile, $dataForView);
     }
     if (empty($dataForView)) {
         $dataForView = $this->viewVars;
     }
     // -- set template
     $this->Phptal->setTemplate($viewFile);
     // -- set values
     foreach ($dataForView as $key => $value) {
         $this->Phptal->set($key, $value);
     }
     // set this View class
     $this->Phptal->set('view', $this);
     // -- render
     ob_start();
     try {
         echo $this->Phptal->execute();
     } catch (Exception $e) {
         debug($e->__toString());
     }
     $out = ob_get_clean();
     return $out;
 }
Example #2
0
 /**
  * Evalute a view file, rendering it's contents
  *
  * @return string The output
  */
 protected function _evaluate($viewFile, $dataForView)
 {
     $file = new File($viewFile);
     if ($file->ext() != self::$extension) {
         return parent::_evaluate($viewFile, $dataForView);
     }
     $file = $this->_createRenderedView($viewFile);
     $content = parent::_evaluate($file, $dataForView);
     $this->_deleteRenderedView($file);
     return $content;
 }
Example #3
0
 /**
  * Sandbox method to evaluate a template / view script in.
  *
  * @param string $viewFile Filename of the view
  * @param array $dataForView Data to include in rendered view.
  *    If empty the current View::$viewVars will be used.
  * @return string Rendered output
  */
 protected function _evaluate($viewFile, $dataForView)
 {
     // ADD 2016/05/12 ryuring
     // デバッグモード2でテンプレート一覧を出力する為に追加
     // >>>
     if (Configure::read('debug') > 1) {
         $this->_viewFilesLog[] = $viewFile;
     }
     // <<<
     return parent::_evaluate($viewFile, $dataForView);
 }