Layout 使用Zend Framework 2布局。默认布局

Layout 使用Zend Framework 2布局。默认布局,layout,zend-framework2,Layout,Zend Framework2,我从配置的一个通用模块开始: <?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (

我从配置的一个通用模块开始:

<?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

return array(
    'router' => array(
        'routes' => array(
            'home' => array(
                'type' => 'Zend\Mvc\Router\Http\Literal',
                'options' => array(
                    'route'    => '/',
                    'defaults' => array(
                        'controller' => 'Common\Controller\Index',
                        'action'     => 'index',
                    ),
                ),
            ),
        ),
    ),
    'service_manager' => array(
        'factories' => array(
            'translator' => 'Zend\I18n\Translator\TranslatorServiceFactory',
        ),
    ),
    'translator' => array(
        'locale' => 'en_US',
        'translation_file_patterns' => array(
            array(
                'type'     => 'gettext',
                'base_dir' => __DIR__ . '/../language',
                'pattern'  => '%s.mo',
            ),
        ),
    ),
    'controllers' => array(
        'invokables' => array(
            'Common\Controller\Index' => 'Common\Controller\IndexController'
        ),
    ),
    'view_helpers' => array(
        'invokables' => array(
            'flashMessengerHelper' => 'Common\View\Helper\FlashMessenger',
        ),
    ),
    'view_manager' => array(
        'display_not_found_reason' => true,
        'display_exceptions'       => true,
        'doctype'                  => 'HTML5',
        'not_found_template'       => 'error/404',
        'exception_template'       => 'error/index',
        'template_path_stack' => array(
            __DIR__ . '/../view',
        ),
    ),
);
    <?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

return array(
    'router' => array(
        'routes' => array(
            'wall' => array(
                'type' => 'Zend\Mvc\Router\Http\Segment',
                'options' => array(
                    'route'    => '/:username',
                    'constraints' => array(
                        'username' => '\w+'
                    ),
                    'defaults' => array(
                        'controller' => 'Wall\Controller\Index',
                        'action'     => 'index',
                    ),
                ),
            )
        ),
    ),
    'controllers' => array(
        'invokables' => array(
            'Wall\Controller\Index' => 'Wall\Controller\IndexController'
        ),
    ),
    'view_manager' => array(
        'template_path_stack' => array(
            __DIR__ . '/../view',
        ),
    ),
);

您发布的配置将向视图管理器的模板路径堆栈添加两个路径:
zf2 client\module\Common\view
zf2 client\module\Wall\view
。默认情况下,ZF2查找名为
layout/layout
的视图进行渲染。它将检查视图堆栈中是否有匹配的文件。由于您只有其中一个,并且它位于您的公共模块中,因此将使用它。

您发布的配置将向视图管理器的模板路径堆栈添加两个路径:
zf2 client\module\Common\view
zf2 client\module\Wall\view
。默认情况下,ZF2查找名为
layout/layout
的视图进行渲染。它将检查视图堆栈中是否有匹配的文件。由于您只有其中一个,并且它位于您的公共模块中,因此将使用它。

您发布的配置将向视图管理器的模板路径堆栈添加两个路径:
zf2 client\module\Common\view
zf2 client\module\Wall\view
。默认情况下,ZF2查找名为
layout/layout
的视图进行渲染。它将检查视图堆栈中是否有匹配的文件。由于您只有其中一个,并且它位于您的公共模块中,因此将使用它。

您发布的配置将向视图管理器的模板路径堆栈添加两个路径:
zf2 client\module\Common\view
zf2 client\module\Wall\view
。默认情况下,ZF2查找名为
layout/layout
的视图进行渲染。它将检查视图堆栈中是否有匹配的文件。因为您只有其中一个,并且它在您的公共模块中,所以使用了它