public function Haml::renderFile in Sassy 7
* Renders a view file. * This method is required by {@link IViewRenderer}. *
Parameters
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.
File
- phamlp/
Yii/ phamlp/ Haml.php, line 208
Class
- Haml
- HamlViewRenderer allows you to write view files in {@link Haml http://haml-lang.com/}. @package PHamlP @subpackage Yii
Code
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);
}