0
votes

i am trying to install 'EdpModuleLayouts'

i have followed the instruction for the module here:

i also followed the issue here:

i. e; I placed the following code in my application.config.php?

return array(
    'modules' => array(
        ... ,
        'EdpModuleLayouts'
   )
);

i then placed the following code in my module config

'view_manager' => array(
        'template_path_stack' => array(
            'workers' => __DIR__ . '/../view',
            'Workers/layout' => __DIR__ . '/../view/layout/layout.phtml'
        ),
    ),
    'module_layouts' => array(
    'Workers' => 'Workers/layout'
),

i got the following error report:

Fatal error: Uncaught exception 'Zend\View\Exception\RuntimeException' with message 'Zend\View\Renderer\PhpRenderer::render: Unable to render template "Workers/layout"; resolver could not resolve to a file' in zendframework\zendframework\library\Zend\View\Renderer\PhpRenderer.php on line 499

1

1 Answers

1
votes

The error message is so specific.

Unable to render template "Workers/layout"

This means that there is no template Workers/layout defined within the view_manager configuration. And the trick here is that you made a simple mistake of placing the configuration at the wrong place.

template_path_stack is used to give the view_manager information about some folders where template files are mapped going by their file-path.

template_map is used to give the view_manager information about which file covers a specific template.

The difference of the two can easily be seen when checking the module.config.php of the ZendSkeletonApplication. With this in mind, all you have to do is to change your configuration.

Another hint: don't CamelCase configuration keys, keep them lowercased ;)

'view_manager' => array(
    'template_path_stack' => array(
        'workers' => __DIR__ . '/../view',
    ),
    'template_map' => array(
        // consider to make this lowercase "workers/layout"
        'Workers/layout' => __DIR__ . '/../view/layout/layout.phtml'
    )
),
'module_layouts' => array(
    'Workers' => 'Workers/layout'
),