不同模块的多种布局-Zend Framework [英] Multiple layouts for different modules - Zend Framework

查看:76
本文介绍了不同模块的多种布局-Zend Framework的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Zend Framework中的布局有疑问. 这是我的项目结构:

I have a question about layouts in Zend Framework. This is my structure of my project:

  • 我有2个名为"backoffice"和"frontoffice"的模块.
  • 我在后台和前台的布局/脚本中都有一个layout.phtml.
  • 现在我要为后台办公室"和前台办公室"分别设置布局/脚本"
  • 在我的application.ini中,我有:resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
  • I have 2 modules named "backoffice" and "frontoffice".
  • I have one layout.phtml in layouts/scripts for both the backoffice and frontoffice.
  • Now I want seperate "layouts/scripts" for "backoffice" and "frontoffice"
  • In my application.ini I have: resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"

现在如何解决具有单独布局的问题?

Now how can I fix this that I have seperate layouts?

推荐答案

只需在layout/scripts文件夹中放置另一个布局,并告诉任何模块,控制器或操作使用该其他布局而不是默认布局.

Just place another layout in the layout/scripts folder and tell any module, controller or action to use that other layout instead of the default layout.

如果要让控制器使用其他布局,可以在init()

If you want to let a controller use a different layout, you can place the following in your init()

$this->_helper->layout->setLayout('layoutname');

您可以分别针对特定操作或整个模块执行此操作.

You can do that respectively for specific actions or for a whole module.

这篇关于不同模块的多种布局-Zend Framework的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆