Wige
Wige

Reputation: 3918

ZF2 multiple module base path

On Zend Framework 2, I am trying to set different base_paths in the view manager for each module in the framework. However, the base_path I set for the last module is the one that is being applied. How can I set module specific base_paths for ZF2?

This is how I am setting the base path in each module.config.php:

'view_manager' => array(
    'base_path' => '/zend/modulename/',
    'display_not_found_reason' => true,
    'display_exceptions'       => true,
    'doctype'                  => 'HTML5',
    'not_found_template'       => 'error/404',
    'exception_template'       => 'error/index',
    'template_map' => array(
        'layout/layout'           => __DIR__ . '/../view/layout/layout.phtml',
        'layout/guest'           => __DIR__ . '/../view/layout/guest.phtml',
        'modulename/index/index'  => __DIR__ . '/../view/modulename/index/index.phtml',
        'error/404'               => __DIR__ . '/../view/error/404.phtml',
        'error/index'             => __DIR__ . '/../view/error/index.phtml',
    ),
    'template_path_stack' => array(
        __DIR__ . '/../view',
    ),
),

Upvotes: 0

Views: 365

Answers (1)

Mattin
Mattin

Reputation: 94

I think you don't need to set base path for your module. If you have Module.php in your module src folder, then you can use DIR or relative path from Module.php.

Upvotes: 1

Related Questions