问题描述
我有两个模块学生和老师.我也有两种不同的布局,一种是 studentlayout.phtml,另一种是 Teacherlayout.phtml
I have two module Student and Teacher.I also have two different layout one is studentlayout.phtml and another is teacherlayout.phtml
如何为学生模块设置学生布局,为教师模块设置教师布局?
How can I set studentlayout for Student module and teacherlayout for Teachermodule?
按照 Sam 的回答.谢谢它工作正常.
As Per Sam's answer .Thanks Its working fine.
但我也想为老师设置两种不同的布局.所以我在项目的主配置文件中添加以下代码:
but i also want to set two different layout For Teacher.So i add following code in my main config file for project:
'module_layouts' => array(
'Teacher' => array(
'default' => 'layout/adminlayout',
'login' => 'layout/loginlayout',
),
'Student' => 'layout/studentlayout',
),
我的教师模块的 module.config.php 文件:
My module.config.php file for teacher module:
'module_layouts' => array(
'Teacher' => array(
'default' => 'layout/adminlayout',
'login' => 'layout/loginlayout',
),
'Student' => 'layout/studentlayout',
),
但一直以来,教师模块的所有操作都采用 adminlayout.为什么登录操作不能采用 loginlayout?它的 oververide?p>
But all time all action of Teacher module take adminlayout. why login action can't take loginlayout?its ovveride?
推荐答案
用法
使用 EdpModuleLayouts 非常非常简单.在任何模块配置或自动加载的配置文件中,只需指定以下内容:
Using EdpModuleLayouts is very, very simple. In any module config or autoloaded config file simply specify the following:
array(
'module_layouts' => array(
'Teacher' => 'layout/teacher',
'Student' => 'layout/student'
),
);
就是这样!当然,您也需要定义这些布局...只需查看应用程序模块 module.config.php
以了解如何定义布局.
That's it! Of course you need to define those layouts, too... just check Application Modules module.config.php
to see how to define a layout.
这篇关于在 Zend Framework 2 中为不同的模块设置不同的布局?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!