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


PHP Controller::render方法代碼示例

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


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

示例1: render

 /**
  * If we are acting in the module context and the layout is empty we only should renderPartial the content.
  *
  * @param string $view   The name of the view file (e.g. index)
  * @param array  $params The params to assign into the value for key is the variable and value the content.
  *
  * @return string
  */
 public function render($view, $params = [])
 {
     if (!empty($this->module->context) && empty($this->layout)) {
         return $this->renderPartial($view, $params);
     }
     return parent::render($view, $params);
 }
開發者ID:krystian-thiede,項目名稱:luya,代碼行數:15,代碼來源:Controller.php

示例2: display

 /**
  * Modified render method to display the view. This takes in the view id as a parameter instead of
  * view name.
  *
  * @param int   $view the view identifier as set in one of Module::VIEW constants
  * @param array $params the parameters (name-value pairs) that should be made available in the view.
  * These parameters will not be available in the layout.
  *
  * @return string the rendering result
  */
 public function display($view, $params = [])
 {
     if (!empty($this->_module->getLayout($view))) {
         $this->layout = $this->_module->getLayout($view);
     }
     $view = $this->fetchView($view);
     return parent::render($view, $params);
 }
開發者ID:communityii,項目名稱:yii2-user,代碼行數:18,代碼來源:BaseController.php

示例3: render

 public function render($view, $params = [])
 {
     if (Yii::$app->request->isAjax) {
         return $this->renderAjax($view, $params);
     } else {
         return parent::render($view, $params);
     }
 }
開發者ID:nickypeng,項目名稱:yii2-oauth2-server,代碼行數:8,代碼來源:ClientController.php

示例4: render

 public function render($view, $data = NULL, $return = false)
 {
     if (isset($_POST['minimal'])) {
         echo \yii\helpers\Json::encode(parent::renderPartial($view, $data, true));
     } else {
         return parent::render($view, $data, $return);
     }
 }
開發者ID:chaimvaid,項目名稱:linet3,代碼行數:8,代碼來源:RightsController.php

示例5: render

 /**
  * Автоматический renderPartial, если ajax-запрос.
  */
 public function render($view, $params = [], $returnContent = false)
 {
     if (Yii::$app->request->isAjax) {
         return parent::renderPartial($view, $params, $returnContent);
     } else {
         return parent::render($view, $params, $returnContent);
     }
 }
開發者ID:alhimik1986,項目名稱:test_for_job,代碼行數:11,代碼來源:BooksController.php

示例6: render

 public function render($params = [], $view = '')
 {
     if ($view == '') {
         $view = \Yii::$app->controller->action->id;
     }
     $view = $view . ".html";
     $arr = array_merge($params, $this->assign);
     return parent::render($view, $arr);
 }
開發者ID:xswolf,項目名稱:baihey,代碼行數:9,代碼來源:BaseController.php

示例7: render

 public function render($view, $params = [])
 {
     $position = $this->module->positionMenu;
     if (in_array($position, ['left', 'top', 'right'])) {
         return parent::render("/layouts/{$position}-menu", ['view' => $view, 'params' => $params]);
     } else {
         return parent::render($view, $params);
     }
 }
開發者ID:hscstudio,項目名稱:yii2-heart,代碼行數:9,代碼來源:Controller.php

示例8: render

 public function render($view = null, $params = [])
 {
     if (is_array($view)) {
         $params = $view;
         $view = null;
     }
     if ($view === null) {
         $view = $this->action->id;
     }
     return parent::render($view, $params);
 }
開發者ID:remk-wadriga,項目名稱:calories-calculating-yii2-project,代碼行數:11,代碼來源:ControllerAbstract.php

示例9: render

 public function render($view, $params = [])
 {
     $ua_arr = ['ua' => (object) $this->getua()];
     $urlParams = ['urlParams' => (object) Yii::$app->request->getQueryParams()];
     $tpldata = array_merge($params, $urlParams, $ua_arr);
     $tpldata['APP_CODE'] = @\Yii::$app->params['app_code'];
     Yii::$app->view->params['tpldata'] = (object) $tpldata;
     $params['tplData'] = $tpldata;
     Yii::$app->response->formatters[Response::FORMAT_HTML] = 'mysoft\\web\\MyHtmlResponseFormatter';
     return parent::render($view, $params);
 }
開發者ID:gtyd,項目名稱:jira,代碼行數:11,代碼來源:Controller.php

示例10: render

 public function render($view, $params = [])
 {
     $devicedetect = \Yii::$app->devicedetect;
     $isMobile = $devicedetect->isMobile();
     $isTablet = $devicedetect->isTablet();
     $mobileTpl = $isMobile && !$isTablet;
     // detect and change layout
     if ($mobileTpl) {
         $this->layout = '@app/views/layouts/sp_main';
     }
     // detect and render view
     $detectView = $view . ($mobileTpl ? '_sp' : '');
     $detectPath = parent::getViewPath() . "/{$detectView}.php";
     return parent::render(file_exists($detectPath) ? $detectView : $view, $params);
 }
開發者ID:kaihatsusha,項目名稱:kpimon,代碼行數:15,代碼來源:MobiledetectController.php

示例11: render

 /**
  * @param string $view
  * @param array $params
  * @return string
  */
 public function render($view, $params = [])
 {
     if (!$this->beforeRender || $this->module instanceof Application) {
         return parent::render($view, $params);
     }
     try {
         $viewApp = $this->beforeRender . $this->module->id . '/' . $this->id . '/' . $view;
         return parent::render($viewApp, $params);
     } catch (InvalidParamException $e) {
         \Yii::error($e->getMessage());
         try {
             return parent::render($view, $params);
         } catch (InvalidParamException $e) {
             return $this->output($e->getMessage());
         }
     }
 }
開發者ID:Liv1020,項目名稱:cms,代碼行數:22,代碼來源:Controller.php

示例12: render

 /**
  * @param string $view
  * @param array $params
  * @return string
  */
 public function render($view, $params = [])
 {
     if ($this->module instanceof Application) {
         return parent::render($view, $params);
     }
     if (strpos($view, '/') && !strpos($view, '@app/views')) {
         return parent::render($view, $params);
     }
     $viewDir = "@app/views/modules/" . $this->module->id . '/' . $this->id;
     $viewApp = $viewDir . '/' . $view;
     if (isset(\Yii::$app->view->theme->pathMap['@app/views'])) {
         $tmpPaths = [];
         foreach (\Yii::$app->view->theme->pathMap['@app/views'] as $path) {
             $tmpPaths[] = $path . "/modules/" . $this->module->id . '/' . $this->id;
         }
         $tmpPaths[] = $this->viewPath;
         \Yii::$app->view->theme->pathMap = ArrayHelper::merge(\Yii::$app->view->theme->pathMap, [$viewDir => $tmpPaths]);
     }
     return parent::render($viewApp, $params);
 }
開發者ID:skeeks-cms,項目名稱:cms,代碼行數:25,代碼來源:Controller.php

示例13: render

 public function render($view, $params = [])
 {
     $this->beforeRender($params);
     return parent::render($view, $params);
 }
開發者ID:Polymedia,項目名稱:BI-Platform-v3,代碼行數:5,代碼來源:BaseDashboardController.php

示例14: render

 public function render($view, $params = [])
 {
     \worstinme\forum\assets\Asset::register($this->view);
     return parent::render($view, $params);
 }
開發者ID:worstinme,項目名稱:yii2-forum,代碼行數:5,代碼來源:DefaultController.php

示例15: render

 /**
  * redefine controller render function
  * 
  * @see \yii\base\Controller::render()
  */
 public function render($view, $params = [])
 {
     $content = parent::render($view, $params);
     return $this->compressHtml($content);
 }
開發者ID:weiyiyi,項目名稱:base,代碼行數:10,代碼來源:Controller.php


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