Reputation: 905
I have already seen all the links that are already discussed for this topic but could not seem to be working for me, therefor I would like to open this discussion once more and show you my config files as well..
First of all my folder structure is like this:
So far I have module.config.php like this:
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',
),
),
),
),
),
);
Upvotes: 1
Views: 9912
Reputation: 30
Add this method to Album\Module.php
public function getConfig()
{
return include __DIR__ . '/config/module.config.php';
}
Upvotes: 0
Reputation: 1528
you forgot
'not_found_template' => 'error/404',
'exception_template' => 'error/index',
like that:
'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',
),
Upvotes: 0
Reputation: 13558
You probably have an Application module where there is a file view/error/404.phtml
. Remove the following lines from the Album module (so not the Application module):
'error/404' => __DIR__ . '/../view/error/404.phtml',
'error/index' => __DIR__ . '/../view/error/index.phtml',
What happens is the Album module overrides the Application module with its configuration. The Album module refers to the error page which does not exists in the Album module (see, in the album there is no view/error/404.phtml file
).
If you also removed the Application module, get it back from the skeleton application and everything will work again.
Upvotes: 3