當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CController::getLayoutFile方法代碼示例

本文整理匯總了PHP中CController::getLayoutFile方法的典型用法代碼示例。如果您正苦於以下問題:PHP CController::getLayoutFile方法的具體用法?PHP CController::getLayoutFile怎麽用?PHP CController::getLayoutFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CController的用法示例。


在下文中一共展示了CController::getLayoutFile方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: render

 /**
  * Render full HTML page. A controller/action that uses XPage to render page
  * can render its view in Yii's standard way or render a constructed page with a
  * main view and multiple sidebars of left and right of the main content.
  *
  * @param bool $return
  *
  * @return mixed|string
  */
 public function render($return = false)
 {
     $this->registerAssets();
     /**
      * re-implement the render() of CController but not firing events
      * for beforeRender and afterRender as they are not really useful
      */
     $this->renderColumn('left');
     $this->renderColumn('main');
     $this->renderColumn('right');
     $content = '';
     foreach ($this->views['main'] as $renderedInfo) {
         $content .= "\n" . $renderedInfo['content'];
     }
     $this->views['content'] = $content;
     if (($layoutFile = $this->controller->getLayoutFile($this->controller->layout)) !== false) {
         $output = $this->controller->renderFile($layoutFile, $this->views, true);
     } else {
         $leftContent = '';
         foreach ($this->views['left'] as $renderedInfo) {
             $leftContent = "\n" . $renderedInfo['content'];
         }
         $rightContent = '';
         foreach ($this->views['right'] as $renderedInfo) {
             $rightContent = "\n" . $renderedInfo['content'];
         }
         $output = $leftContent . "\n" . $content . "\n" . $rightContent;
     }
     $output = $this->controller->processOutput($output);
     if ($return) {
         return $output;
     } else {
         echo $output;
     }
 }
開發者ID:hung5s,項目名稱:yap,代碼行數:44,代碼來源:XPage.php

示例2: render

 /**
  * Render a view file and return result
  *
  * If $controller is not set, the (localized) view file is searched in $viewPath
  * and the layout in $layoutFile is applied, if set.
  *
  * @param string $view name of view to render
  * @param array $data view data
  * @return string rendered content
  */
 private function render($view, $data = array())
 {
     if (($controller = $this->controller) === null) {
         static $controller;
         if ($controller === null) {
             $controller = new CController('pdffile');
         }
         $controller->layout = $this->layout;
         // Required to make console app play nicely during rendering
         Yii::app()->attachBehavior('consoleWorkaround', array('class' => 'ConsoleAppWorkaround', '_viewPath' => $this->baseViewPath, '_layoutPath' => $this->layoutPath));
         $file = Yii::app()->findLocalizedFile($this->viewPath . '/' . $view . '.php');
         if ($file === false) {
             throw new CException('Could not find view file ' . $view);
         }
         ini_set('implicit_flush', false);
         $content = $controller->renderInternal($file, $data, true);
         if ($controller->layout === null) {
             return $content;
         }
         return $controller->renderInternal($controller->getLayoutFile($controller->layout), array('content' => $content), true);
     } else {
         return $controller->render($view, $data, true);
     }
 }
開發者ID:vovancho,項目名稱:baseportal,代碼行數:34,代碼來源:PdfFile.php

示例3: getLayoutFile

 /**
  * @inheritDoc
  */
 public function getLayoutFile($layoutName)
 {
     if (($layoutFile = parent::getLayoutFile($layoutName)) === false) {
         $layoutFile = $this->getDefaultViewFile($layoutName, 'layouts');
     }
     return $layoutFile;
 }
開發者ID:azamath,項目名稱:yii-account,代碼行數:10,代碼來源:Controller.php


注:本文中的CController::getLayoutFile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。