yii2 - 由views/page/xxx.php 来决定使用哪个layout
怪我咯
怪我咯 2017-04-10 15:34:04
0
1
312

想法如下:
有时候我觉得用views中的参数来决定用哪个layout
这样子该怎么做呢?

frontend/views/page/xxx.php
$this->layout='main'; 报错

<?php include("../layouts/main.php"); ?>报错

该怎么做呢?

由view倒置决定使用哪个layout怎么做到?

解决方法:

$this->context->layout='page';
怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(1)
伊谢尔伦
$this->content->layout = '@app/views/layouts/other.php';
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template