/**
  * @param string $sourceFile
  * @param string $viewFile
  */
 public function generateViewFile($sourceFile, $viewFile)
 {
     if ($this->instance) {
         return $this->instance->generateViewFile($sourceFile, $viewFile);
     }
     return null;
 }
Пример #2
0
 /**
  * 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);
 }
Пример #3
0
 /**
  * Do a sanity check on the options and setup alias to filters
  */
 public function init()
 {
     if (isset($this->filterPathAlias)) {
         $this->filterPath = Yii::getPathOfAlias($this->filterPathAlias);
     }
     $options = array();
     foreach ($this->hamlOptions as $option) {
         if (isset($this->{$option})) {
             $options[$option] = $this->{$option};
         }
     }
     // foreach
     $this->haml = new HamlParser($options);
     parent::init();
 }