Fixes #2912: Relative view files will be looked for under the directory containing the view currently being rendered

This commit is contained in:
Qiang Xue
2014-03-28 21:54:32 -04:00
parent 48383f9a19
commit 92bd71cd84
10 changed files with 77 additions and 76 deletions

View File

@ -173,7 +173,7 @@ class Widget extends Component implements ViewContextInterface
*
* If the view name does not contain a file extension, it will use the default one `.php`.
* @param string $view the view name. Please refer to [[findViewFile()]] on how to specify a view name.
* @param string $view the view name.
* @param array $params the parameters (name-value pairs) that should be made available in the view.
* @return string the rendering result.
* @throws InvalidParamException if the view file does not exist.
@ -206,15 +206,4 @@ class Widget extends Component implements ViewContextInterface
return dirname($class->getFileName()) . DIRECTORY_SEPARATOR . 'views';
}
/**
* Finds the view file based on the given view name.
* File will be searched under [[viewPath]] directory.
* @param string $view the view name.
* @return string the view file path. Note that the file may not exist.
*/
public function findViewFile($view)
{
return $this->getViewPath() . DIRECTORY_SEPARATOR . $view;
}
}