本文整理匯總了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);
}