当前位置: 首页>>代码示例>>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;未经允许,请勿转载。