/**
  * @param CBaseController $context
  * @param string $sourceFile
  * @param array $data
  * @param boolean $return
  * @return mixed
  */
 public function renderFile($context, $sourceFile, $data, $return)
 {
     $this->_stack[] = array('view' => $sourceFile, 'data' => $data);
     if ($this->instance) {
         return $this->instance->renderFile($context, $sourceFile, $data, $return);
     }
     return $context->renderInternal($sourceFile, $data, $return);
 }
예제 #2
0
파일: Haml.php 프로젝트: AnnaNee/wordless
 /**
  * Renders a view file.
  * This method is required by {@link IViewRenderer}.
  * @param CBaseController the controller or widget who is rendering the view file.
  * @param string the view file path
  * @param mixed the data to be passed to the view
  * @param boolean whether the rendering result should be returned
  * @return mixed the rendering result, or null if the rendering result is not needed.
  */
 public function renderFile($context, $sourceFile, $data, $return)
 {
     $hamlSourceFile = substr($sourceFile, 0, strrpos($sourceFile, '.')) . $this->fileExtension;
     if (!is_file($hamlSourceFile) || ($file = realpath($hamlSourceFile)) === false) {
         return parent::renderFile($context, $sourceFile, $data, $return);
     }
     $viewFile = $this->getViewFile($sourceFile);
     $viewFile = str_replace($this->fileExtension . ($this->useRuntimePath ? '' : 'c'), $this->viewFileExtension, $viewFile);
     if (!$this->cache || @filemtime($sourceFile) > @filemtime($viewFile)) {
         $this->generateViewFile($sourceFile, $viewFile);
         @chmod($viewFile, $this->filePermission);
     }
     return $context->renderInternal($viewFile, $data, $return);
 }