Yii: Render action using different layout than controller's layout

后端 未结 2 1416
情话喂你
情话喂你 2021-02-01 18:13

In Yii, is there a way to render a single action using a different layout than that defined for the controller? I have an action that I would like to format differe

2条回答
  •  渐次进展
    2021-02-01 18:51

    That wiki entry does a pretty good job in describing how to use layouts, definitely worth a read. I do think you can set a layout default at the start of your controller class and then override that within a particular action function without having to define layout in each action, at least it's worked for me. You can also use the beforeAction function for any complex situations. And, as you may already know, you can use renderPartial to bypass the layout entirely.

提交回复
热议问题