render() public method

The view to be rendered can be specified in one of the following formats: - path alias (e.g. "@app/views/site/index"); - absolute path within application (e.g. "//site/index"): the view name starts with double slashes. The actual view file will be looked for under the [[Application::viewPath|view path]] of the application. - absolute path within current module (e.g. "/site/index"): the view name starts with a single slash. The actual view file will be looked for under the [[Module::viewPath|view path]] of the [[Controller::module|current module]]. - relative view (e.g. "index"): the view name does not start with @ or /. The corresponding view file will be looked for under the [[ViewContextInterface::getViewPath()|view path]] of the view $context. If $context is not given, it will be looked for under the directory containing the view currently being rendered (i.e., this happens when rendering a view within another view).
See also: renderFile()
public render ( string $view, array $params = [], object $context = null ) : string
$view string the view name.
$params array the parameters (name-value pairs) that will be extracted and made available in the view file.
$context object the context to be assigned to the view and can later be accessed via [[context]] in the view. If the context implements [[ViewContextInterface]], it may also be used to locate the view file corresponding to a relative view name.
return string the rendering result
コード例 #1
0
ファイル: View.php プロジェクト: efueger/luya
 public function render($view, $params = [], $context = null)
 {
     if ($this->id === null) {
         throw new \Exception("The ActiveWindow View 'id' can't be empty!");
     }
     if ($this->module === null) {
         throw new \Exception("The ActiveWindow View 'module' can't be empty!");
     }
     if ($context === null) {
         $context = new \admin\ngrest\base\ViewContext();
         $context->module = $this->module;
         $context->id = $this->id;
     }
     return parent::render($view, $params, $context);
 }
コード例 #2
0
ファイル: redemption.php プロジェクト: wuwenhan/huoqiwang
echo yii\helpers\Url::to(['setting/setting']);
?>
">个人设置</a></li>
                <li class="Personal5"><a href="<?php 
echo yii\helpers\Url::to(['invitation/invitation']);
?>
">邀请注册</a></li>
                <!--  <li class="Personal6"><a href="<?php 
echo yii\helpers\Url::to(['law/law']);
?>
">法律服务</a></li>  -->
            </ul>
        </div>
        <div class="right" id="right" style="background:#f6f6f6; border:none;">
        	<?php 
echo View::render("@www/views/layouts/ucenter.php", ['infos_rar' => $infos_rar]);
?>
            <div class="shadowBox page-con6">
                <ul class="page-con6tab clearFloat">
                    <li data-cato="bindcard">绑定银行卡</li>
                    <li data-cato="recharge">充值</li>
                    <li data-cato="redemption">赎回</li>
                    <li data-cato="withdraw">提现</li>
                </ul>
                <div class="page-con6con" id="tx">
                    <p class="xj-wan002">每日赎回限定为<span><?php 
echo $config['ransom_num'];
?>
</span>次,赎回限额<span><?php 
echo (int) $config['ransom_min'];
?>
コード例 #3
0
 /**
  * @param string $namespace
  * @return array
  */
 private function generateCode($namespace)
 {
     $files = [];
     foreach ($this->definition as $category => $values) {
         $view = new View();
         $params = ['constants' => $this->generateConstants($values), 'namespace' => $namespace, 'className' => $category];
         $code = $view->render($this->templateFile, $params, $this);
         $files[$category] = $code;
     }
     return $files;
 }
コード例 #4
0
ファイル: View.php プロジェクト: hiqdev/hidev
 public function render($template, $data = [], $context = null)
 {
     return parent::render($template, $data, isset($context) ? $context : $this->getContext());
 }