Zend framework 为基于模块的Zend应用程序选择不同的视图

Zend framework 为基于模块的Zend应用程序选择不同的视图,zend-framework,Zend Framework,我已使用addModuleDirectory在应用程序中定义了模块: Application | modules | module1 | module2 现在,我想在Bootstrap.php中为每个模块设置不同的

我已使用addModuleDirectory在应用程序中定义了模块:

  Application
                |
                modules
                           |
                           module1
                           |
                           module2

现在,我想在Bootstrap.php中为每个模块设置不同的视图。如何实现这一点?

如果您想要的是切换布局的方法,而不是根据模块切换视图,那么您需要的是一个标准

一个真正简单的实现是:

同时具有以下布局结构:

application/layouts/module1/scripts/layout.phtml
application/layouts/module2/scripts/layout.phtml
根据以下配置:

resources.frontController.plugins.LayoutModuleSwitcher = "Ahp\Controller\Plugin\LayoutModuleSwitcher"
resources.layout.layout = "layout"; The name of your layout.phtml without the suffix, needed to init layout

你是说不同的“布局”吗?是的,没错,为每个模块设置不同的视图
resources.frontController.plugins.LayoutModuleSwitcher = "Ahp\Controller\Plugin\LayoutModuleSwitcher"
resources.layout.layout = "layout"; The name of your layout.phtml without the suffix, needed to init layout