2013-08-22 66 views
1

我已經看到了已經討論過的所有關於此主題的鏈接,但似乎無法爲我工作,因此我想再次打開此討論並向您顯示我的配置文件以及..無法呈現模板「錯誤」;解析器無法解析爲文件ZF2

我所有的文件夾結構首先是這樣的: enter image description here

到目前爲止,我有module.config.php這樣的:

return array(
    'controllers' => array(
     'invokables' => array(
      'Album\Controller\Album' => 'Album\Controller\AlbumController',  
     ), 
     'view_manager' => array(
      'template_map' => array(
      'layout/layout'   => __DIR__ . '/../view/layout/layout.phtml', 
      'album/album/index' => __DIR__ . '/../view/album/album/index.phtml', 
      'error/404'    => __DIR__ . '/../view/error/404.phtml', 
      'error/index'    => __DIR__ . '/../view/error/index.phtml', 
       ), 
      'template_path_stack' => array(
       'album' => __DIR__ . '/../view', 
      ) 
     ) 
    ), 

    'router' => array(
     'routes' => array(
      'album' => array(
       'type' => 'segment', 
       'options' => array(
        'route' => '/album[/:action][/:id]', 
        'constraints' => array(
         'action' => '[a-zA-Z][a-zA-Z0-9_-]*', 
         'id'  => '[0-9]+', 
        ), 
        'defaults' => array(
         'controller' => 'Album\Controller\Album', 
         'action'  => 'index', 
        ), 
       ), 
      ), 
     ), 
    ), 

); 

回答

3

你可能有一個應用模塊,其中有一個文件view/error/404.phtml 。取下專輯模塊(所以應用模塊)以下行:

'error/404' => __DIR__ . '/../view/error/404.phtml', 
'error/index' => __DIR__ . '/../view/error/index.phtml', 

會發生什麼事是專輯模塊覆蓋與其配置的應用模塊。 「影集」模塊引用「影集」模塊中不存在的錯誤頁面(請參閱專輯中不存在view/error/404.phtml file)。

如果您還刪除了應用程序模塊,請將其從骨架應用程序中取出並重新運行。

+0

所以desperated的東西得到修復和其他問題就這樣留言: 找不到名稱爲「相冊」的路線 :S – Lulzim

+1

如果解決了這個問題,請打開一個新問題並將其標記爲已解決:)其他用戶更容易找到相同類型問題的答案。 –

0

您忘記

'not_found_template'  => 'error/404', 
    'exception_template'  => 'error/index', 

這樣的:

'view_manager' => array(
     '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', 
      'application/index/index' => __DIR__ . '/../view/application/index/index.phtml', 
      'error/404'    => __DIR__ . '/../view/error/404.phtml', 
      'error/index'    => __DIR__ . '/../view/error/index.phtml', 
     ), 
     'template_path_stack' => array(
      __DIR__ . '/../view', 
     ), 
0

添加此方法專輯\ Module.php

public function getConfig() 
{ 
    return include __DIR__ . '/config/module.config.php'; 
} 
相關問題