【发布时间】:2016-10-13 18:29:40
【问题描述】:
发生了一些非常奇怪的事情。我有两个模块,一个叫Application,另一个叫Dashboard,它们是不同的,彼此无关。我想对它们中的每一个都使用 phtml 布局,这就是我所做的:
module/Application/config/module.config.php:
// ...
'view_manager' => [
'display_not_found_reason' => true,
'display_exceptions' => true,
'doctype' => 'HTML5',
'not_found_template' => 'error/404',
'exception_template' => 'error/index',
'template_map' => [
'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',
],
'template_path_stack' => [
__DIR__ . '/../view',
],
],
module/Dashboard/config/module.config.php:
// ...
'view_manager' => [
'doctype' => 'HTML5',
'template_map' => [
'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
'dashboard/index/index' => __DIR__ . '/../view/dashboard/index/index.phtml',
'error/404' => __DIR__ . '/../view/error/404.phtml',
'error/index' => __DIR__ . '/../view/error/index.phtml',
],
'template_path_stack' => [
__DIR__ . '/../view',
],
],
我创建了两个独立的布局,一个在module/Application/view/layout/layout.phtml,另一个在module/Dashboard/view/layout/layout.phtml,逻辑上它必须工作,但它没有,它总是调用Dashboard布局,即使是Application .
我想知道,如何为每个模块使用单独的布局?
【问题讨论】:
-
这可能会有所帮助 -> stackoverflow.com/questions/16054191/…
标签: php zend-framework zend-framework2