Home > Backend Development > PHP Tutorial > Yii的module调用layout的有关问题

Yii的module调用layout的有关问题

WBOY
Release: 2016-06-13 10:07:23
Original
898 people have browsed it

Yii的module调用layout的问题
是这样的,为了分离网站前后台,选择使用module添加了一个admin模块
在AdminModule.php的init()方法里添加了

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$this->layout='main';
Copy after login


并且modules/admin/views/layouts/column1.php里也修改如下
PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?php $this->beginContent(); ?><div class="container">    <div id="content">        <?php echo $content; ?>    </div>
<!-- content -->
</div><?php $this->endContent(); ?>
Copy after login


应该说admin/default/index会调用本module里的布局文件,即/protected/modules/admin/views/layouts/main.php
但是为什么网页显示出来的布局还是父层/protected/views/layouts/main.php的布局?
本人yii新手,请各位不吝赐教,谢谢

------解决方案--------------------
$this->layout='application.modules.views.layouts.main';试试
------解决方案--------------------
探讨

$this->layout='application.modules.views.layouts.main';试试
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template