2013-07-18 118 views
0

,我们怎样才能ZF2设置默认布局,如果布局文件夹是从侧模块目录Zend的布局ZF2

enter image description here

+0

你可以检查这个SO帖子http://stackoverflow.com/questions/13837841/how-to-call-default-layout-in-zf2-for-all-modules-or-selected-modules –

回答

1

您可以设置布局任何你想要它并不一定要在模块目录。

只是设置你的模块配置

'view_manager' => array(
    'display_not_found_reason' => true, 
    'display_exceptions'  => true, 
    'doctype'     => 'HTML5', 
    'not_found_template'  => 'error/404', 
    'exception_template'  => 'error/index', 
    'template_map' => array(
     'layout/layout'   => '/anypath/you/want/view/layout/layout.phtml', 
    ), 
    'template_path_stack' => array(
     '/anypath/you/want/view', 
    ), 
), 
+0

刚开始zf2,我有两个模块专辑和用户哪个module.config.php(在专辑或用户)我应该选择设置默认的?我可以看到这个代码为'template_map'=> array( 'layout/layout'=> __DIR__。'/../view/layout/layout.phtml', – guny

0

按照问题发表@Andrew的答案是正确的内部。

当我注意到ZF2布局的工作我来到了某些结论

  1. 能以应用环境
  2. 只有一个布局采取所有模块反正设置布局文件夹,所采取的布局是从在application.config.php

提到例如最后一个模块

'modules' => array(
     'Album',    
     'Testlist', 
     'Customer', 
     'Application', 
     'User', 

    ), 

然后将采取用户布局。

,如果我们在应用程序中只有一个布局,这将是罚款

要在模块中的布局之间切换跨 http://www.webtrafficexchange.com/zf2-configure-layout-each-module-edpmodulelayouts 这似乎

0

的默认布局在配置layout/layout是有用的来了视图管理器。