I have multiple modules in a ZF2 application. I would like to have different 'not_found_template' and 'exception_template' view_manager settings for each module.
How can I write the piece of code that dynamically injects the settings for these templates? I really need this code to work, even if caching is enabled.
Thanks,
in your module.php
link to the MVC Event EVENT_DISPATCH_ERROR
this event is called when the route/controller etc. was not found and place there your logic what response zf2 should return.
$eventManager->getSharedManager()->attach('*', MvcEvent::EVENT_DISPATCH_ERROR, function(MvcEvent $e){
// place your logic here
}, -100);
don't know if there is a other possibility but zend merge all your configs into one big array so multiple not_found_template
in your config can not work because they get merged by key.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.