duanhe1903 2016-01-03 11:48
浏览 42
已采纳

在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.

  • 写回答

1条回答 默认 最新

  • duanji2002 2016-01-03 12:37
    关注

    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',
        ),
    ),
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站