在app config中移动数组中的模块名称时,ZF2'无法呈现模板'

Good day. I've just started learning ZF2, replicated the Album example step-by-step, and then decided to make it a bit more interesting by adding user registration, and then make the two work together in some way, so i added a new 'Auth' module.

So, when i only had one module in the module list (aside from the Application module) in application.config.php, it was all fine, but when i added the Auth module to the list like so:

'modules' => array('Application', 'Album','Auth',)

i got the following error when trying to access any views from the album module which was working absolutely fine prior to this change:

Zend\View\Renderer\PhpRenderer::render: Unable to render template "album/album/index"; resolver could not resolve to a file

But when i changed the order in which the modules are presented in this array like so:

'modules' => array('Application', 'Auth','Album',)

not a single view (and it has only one) from the Auth module could be rendered, while the Album module was fine.

Zend\View\Renderer\PhpRenderer::render: Unable to render template "auth/user/index"; resolver could not resolve to a file

Both of these views exist at these locations, but the renderer doesn't see them for some reason.

You can see the project's contents here.

Thank you for any tips in advance.

php

1个回答

Looks like you copy pasted the the view manager config for Auth module.config.php.

This should be auth rather than album for your templates to work correctly.

'view_manager' => array(
    'template_path_stack' => array(
        'auth' => __DIR__ . '/../view',
    ),
),
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐