在./config/application.config.php
ZendFramework 2 - 错误装载布局不同模块
return array(
'modules' => array(
'Application',
'Admin',
)
...
我有2个单独的布局,./module/Application/view/layout/layout.phtml
的集合和./module/Admin/view/layout/layout.phtml
在./module/Admin/config/module.config.php
...
'template_map' => array(
'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
'header' => __DIR__ . '/../view/layout/header.phtml',
'footer' => __DIR__ . '/../view/layout/footer.phtml',
'paginator' => __DIR__ . '/../view/layout/paginator.phtml',
'error/404' => __DIR__ . '/../view/error/404.phtml',
'error/index' => __DIR__ . '/../view/error/index.phtml',
)
...
在./module/Application/config/module.config.php
...
'template_map' => array(
'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
'header' => __DIR__ . '/../view/layout/header.phtml',
'footer' => __DIR__ . '/../view/layout/footer.phtml',
'paginator' => __DIR__ . '/../view/layout/paginator.phtml',
'error/404' => __DIR__ . '/../view/error/404.phtml',
'error/index' => __DIR__ . '/../view/error/index.phtml',
)
...
基本上他们是不同的设置和一些内容是不同的。不幸的是,这两个模块只加载位于./module/Admin/config/module.config.php
的布局
我GOOGLE了,但没有来自我想要的任何解决方案。任何人都有这个想法吗?
哇!它完美的作品。谢谢 – 2013-04-30 03:09:52
在ZF 2.2.2中,我必须替换$ moduleNamespace变量,然后它对我有用:'if('Admin'=== $ moduleNamespace){$ controller-> layout('layout/admin'); }' – 2014-03-30 13:16:40