當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。