本文整理汇总了PHP中CWidget::getViewFile方法的典型用法代码示例。如果您正苦于以下问题:PHP CWidget::getViewFile方法的具体用法?PHP CWidget::getViewFile怎么用?PHP CWidget::getViewFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CWidget
的用法示例。
在下文中一共展示了CWidget::getViewFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getViewFile
/**
* Extends CWidgets getViewFile by possibilty to get also themed version
* of a dotted view Filename
*
* @param string $viewName name of the view (without file extension)
* @return string the view file path. False if the view file does not exist
* @see CApplication::findLocalizedFile
*/
public function getViewFile($viewName)
{
// a path alias e.g. application.modules.x.y.z.
if (strpos($viewName, '.') && ($theme = Yii::app()->getTheme()) !== null) {
$themedFile = $theme->getViewFileAliased($viewName);
if ($themedFile) {
return $themedFile;
}
}
return parent::getViewFile($viewName);
}
示例2: getViewFile
/**
* Extends CWidgets getViewFile by possibilty to get also themed version
* of a dotted view Filename
*
* @param string $viewName name of the view (without file extension)
* @return string the view file path. False if the view file does not exist
* @see CApplication::findLocalizedFile
*/
public function getViewFile($viewName)
{
// a path alias e.g. application.modules.x.y.z.
if (strpos($viewName, '.')) {
if (($theme = Yii::app()->getTheme()) !== null) {
// Replace application.modules[_core].MODULEID.widgets.views
// in
// webroot.themes.CURRENTTHEME.views.MODULEID.widgets
$viewNameTheme = $viewName;
$viewNameTheme = str_replace('application.views.', 'webroot.themes.' . $theme->getName() . '.views.', $viewNameTheme);
$viewNameTheme = preg_replace('/application\\.modules(?:_core)?\\.(.*?)\\.views\\.(.*)/i', 'webroot.themes.' . $theme->getName() . '.views.\\1.\\2', $viewNameTheme);
#$viewNameTheme = preg_replace('/widgets\.views/', 'widgets', $viewNameTheme);
$viewFile = Yii::getPathOfAlias($viewNameTheme);
// Check if File exists
if (is_file($viewFile . '.php')) {
return Yii::app()->findLocalizedFile($viewFile . '.php');
}
}
// Fall Back to default
}
return parent::getViewFile($viewName);
}