* @since 2.0 */ class View extends Component { public $file; public $name; /** * @var string|array */ public $basePath; public $owner; public $locale; public function render($_params_ = array()) { $this->resolveViewFile(); extract($_params_, EXTR_OVERWRITE); ob_start(); ob_implicit_flush(false); require($this->file); return ob_get_clean(); } public function resolveViewFile() { if ($this->file !== null) { return $this->file; } if ($this->name === null || $this->basePath) { } if(empty($viewName)) return false; if($moduleViewPath===null) $moduleViewPath=$basePath; if(($renderer=Yii::app()->getViewRenderer())!==null) $extension=$renderer->fileExtension; else $extension='.php'; if($viewName[0]==='/') { if(strncmp($viewName,'//',2)===0) $viewFile=$basePath.$viewName; else $viewFile=$moduleViewPath.$viewName; } else if(strpos($viewName,'.')) $viewFile=Yii::getPathOfAlias($viewName); else $viewFile=$viewPath.DIRECTORY_SEPARATOR.$viewName; if(is_file($viewFile.$extension)) return Yii::app()->findLocalizedFile($viewFile.$extension); else if($extension!=='.php' && is_file($viewFile.'.php')) return Yii::app()->findLocalizedFile($viewFile.'.php'); else return false; } }