当前位置: 首页>>代码示例>>PHP>>正文


PHP CController::resolveViewFile方法代码示例

本文整理汇总了PHP中CController::resolveViewFile方法的典型用法代码示例。如果您正苦于以下问题:PHP CController::resolveViewFile方法的具体用法?PHP CController::resolveViewFile怎么用?PHP CController::resolveViewFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CController的用法示例。


在下文中一共展示了CController::resolveViewFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderMessage

 public function renderMessage($view, array $data = array())
 {
     $controller = new \CController('SmsSender');
     $viewPath = \Yii::app()->getBasePath() . DIRECTORY_SEPARATOR . 'views';
     $viewFile = $controller->resolveViewFile($view, $viewPath, $viewPath);
     $body = $controller->renderInternal($viewFile, $data, true);
     return $body;
 }
开发者ID:knyga,项目名称:sms-sender,代码行数:8,代码来源:SmsSender.php

示例2: resolveViewFile

 /**
  * Allows loading view from dressing.views when application, theme and module views are unavailable.
  *
  * @param string $viewName
  * @param string $viewPath
  * @param string $basePath
  * @param null $moduleViewPath
  * @return mixed
  */
 public function resolveViewFile($viewName, $viewPath, $basePath, $moduleViewPath = null)
 {
     $viewFile = parent::resolveViewFile($viewName, $viewPath, $basePath, $moduleViewPath);
     if ($viewFile) {
         return $viewFile;
     }
     // if not found in app, try to find in dressing.views
     $path = Yii::getPathOfAlias('dressing.views');
     $appViewPath = Yii::app()->getViewPath();
     $viewPath = $path . str_replace($appViewPath, '', $viewPath);
     $basePath = $path . str_replace($appViewPath, '', $basePath);
     return parent::resolveViewFile($viewName, $viewPath, $basePath, null);
 }
开发者ID:zainengineer,项目名称:yii-dressing,代码行数:22,代码来源:YdController.php

示例3: getLayoutFile

 /**
  * Finds the layout file for the specified controller's layout.
  * @param CController $controller the controller
  * @param string $layoutName the layout name
  * @return string the layout file path. False if the file does not exist.
  */
 public function getLayoutFile($controller, $layoutName)
 {
     $moduleViewPath = $basePath = $this->getViewPath();
     $module = $controller->getModule();
     if (empty($layoutName)) {
         while ($module !== null) {
             if ($module->layout === false) {
                 return false;
             }
             if (!empty($module->layout)) {
                 break;
             }
             $module = $module->getParentModule();
         }
         if ($module === null) {
             $layoutName = Yii::app()->layout;
         } else {
             $layoutName = $module->layout;
             $moduleViewPath .= '/' . $module->getId();
         }
     } else {
         if ($module !== null) {
             $moduleViewPath .= '/' . $module->getId();
         }
     }
     return $controller->resolveViewFile($layoutName, $moduleViewPath . '/layouts', $basePath, $moduleViewPath);
 }
开发者ID:juliocp88,项目名称:yii-example,代码行数:33,代码来源:CTheme.php

示例4: renderBody

 /**
  * @param string $view
  * @param string $layout
  * @param array  $data
  *
  * @return string
  */
 public function renderBody($view, $layout = '//layouts/main', array $data = array())
 {
     $controller = new CController('SwiftMailerComponent');
     $viewPath = Yii::app()->getBasePath() . DIRECTORY_SEPARATOR . 'views';
     $viewFile = $controller->resolveViewFile($view, $viewPath, $viewPath);
     $layoutFile = $controller->resolveViewFile($layout, $viewPath, $viewPath);
     $body = $controller->renderInternal($viewFile, $data, true);
     if (null !== $layout) {
         $body = $controller->renderInternal($layoutFile, array('content' => $body), true);
     }
     return $body;
 }
开发者ID:sobit,项目名称:swiftmailer-component,代码行数:19,代码来源:SwiftMailerComponent.php


注:本文中的CController::resolveViewFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。