Unable to render template "album/album/index"


I am having the following error message:

An error occurred

An error occurred during execution; please try again later.

Additional information:





Laminas\View\Renderer\PhpRenderer::render: Unable to render template “album/album/index”; resolver could not resolve to a file

Here is the code of the index page:

How can I fix the error please? Thank you.

Hi there, the error looks like it can’t find the template itself.
By default it checks if there is a template associated within the module.config.php, if not it will inspect the controller matched during routing to determine the module namespace and the controller class name, and, if available, it’s “action” parameter in order to create a template name like so:


In your case it’s trying to find the template within /Album/view/album/album/index.phtml
Or you can just specify the path you want in the module.config.php file as such assuming your using the namespace of Album, controller of IndexController and action of indexAction:

'view_manager' => [
    'template_map' => [
        'album/index/index' => __DIR__ . '/../view/album/index/index.phtml',

If you still can’t fix it, post on how you have your module.config.php and controller.

Thanks CDW. It works! However I have modified slightly your code this way to match my configuration:

‘view_manager’ => [
‘template_map’ => [
‘album/album/index’ => DIR . ‘/…/view/album/album/index.phtml’,

No problem.

You can always specify different paths as long the key of the array respects the module/controller/action format.

Also quick note, your using 3 dots instead of only 2 in the part after the DIR which i’m assuming you’re using as a constant.