zf2 about layout.phtml and error 404 setting

For programming and general questions on Zend Framework
Post Reply
Posts: 23
Joined: Sat Sep 08, 2012 3:15 am

zf2 about layout.phtml and error 404 setting

Post by jobsfan » Sat Dec 29, 2012 9:58 am


My problem, there are two modules in my project, one application, the other admin. both of them has layout folder and error folder under there view directory. of course with layout.phtml and error.phtml and 404.phtml inside each.

When I set template_map of view_manager in admin 's module.config.php like:

'template_map' => array(
'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
'application/index/index' => __DIR__ . '/../view/application/index/index.phtml',
'error/404' => __DIR__ . '/../view/error/404.phtml',
'error/index' => __DIR__ . '/../view/error/index.phtml',

in my throughts, I think the admin module will use its own layout and 404, really it does, the performing is the same as I expected, however, what I did't expect that, the default module application module's layout and 404 turn to use the layout and 404 file in admin module(it seems its setting on layout and 404 are overwrited). That's not what I want, I want each module use its own layout and 404 file.

What can I do to solve this? in one project, all the modules can only have one template_map???!!! who can give a positive answer, thank you in advance.

Post Reply