yii render和renderPartial

来源:互联网 发布:手表用的软件 编辑:程序博客网 时间:2024/06/17 12:22

render是调用layout渲染一个view,并显示出来。renderPrtial直接显示一个view

public $layout='//layouts/main';

public function actionFiltrate(){   
         $this->render('/meeting/SHmeting_filtrate');
    }

我们可以把公共的块放到layout中,并且加载所需的js css

如果我们用renderPartial

public function actionFiltrate(){   
         $this->renderPartial('/meeting/SHmeting_filtrate');
    }

需要在view中单独加载js css

在view中嵌套renderPartial页面,将需要使用的变量传递过去

<div class="dszSP" style="height:auto; overflow:hidden;">
<?php echo $this->renderPartial('/meeting/SHmeting_add_form',array('form'=>$form,'model'=>$model,'years'=>$years,'mtype'=>$mtype,'vate_type'=>$vate_type));?>
</div>

原创粉丝点击