# Unable to render template "album/album/index"

**URL:** <https://discourse.laminas.dev/t/unable-to-render-template-album-album-index/1735>\
**Category:** Components & MVC\
**Tags:** laminas-mvc\
**Created:** [July 14, 2020, 10:43pm UTC](https://discourse.laminas.dev/t/unable-to-render-template-album-album-index/1735 "2020-07-14T22:43:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tonguim](https://avatars.discourse-cdn.com/v4/letter/t/ea5d25/32.png) [@tonguim](https://discourse.laminas.dev/u/tonguim)\
**Post date:** [July 14, 2020, 10:43pm UTC](https://discourse.laminas.dev/t/unable-to-render-template-album-album-index/1735/1 "2020-07-14T22:43:12Z")

</div>

Hallo!

I am having the following error message:

> # An error occurred
> 
> ## An error occurred during execution; please try again later.
> 
> ## Additional information:
> 
> ### Laminas\View\Exception\RuntimeException
> 
> File:
> 
> C:\xampp\htdocs\laminas\_2\vendor\laminas\laminas-view\src\Renderer\PhpRenderer.php:497
> 
> Message:
> 
> 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](https://bit.ly/38XZSdw):

How can I fix the error please? Thank you.

---

<div class="post-metadata">

**Author:** ![CDW](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/cdw/32/671_2.png) [@CDW](https://discourse.laminas.dev/u/CDW)\
**Post date:** [July 15, 2020, 9:43am UTC](https://discourse.laminas.dev/t/unable-to-render-template-album-album-index/1735/2 "2020-07-15T09:43:22Z")

</div>

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:

`module/controller/action`

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.

---

<div class="post-metadata">

**Author:** ![tonguim](https://avatars.discourse-cdn.com/v4/letter/t/ea5d25/32.png) [@tonguim](https://discourse.laminas.dev/u/tonguim)\
**Post date:** [July 16, 2020, 6:40am UTC](https://discourse.laminas.dev/t/unable-to-render-template-album-album-index/1735/3 "2020-07-16T06:40:04Z")

</div>

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’,  
],  
],

---

<div class="post-metadata">

**Author:** ![CDW](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/cdw/32/671_2.png) [@CDW](https://discourse.laminas.dev/u/CDW)\
**Post date:** [July 16, 2020, 8:35am UTC](https://discourse.laminas.dev/t/unable-to-render-template-album-album-index/1735/4 "2020-07-16T08:35:50Z")

</div>

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.
