Zend Framework 2 - Set Template Path for Module

2019-09-03 07:47发布

问题:

I googled alot and couldn't come up with an answer...

I'm using the tutorial-skeleton application. It automatically includes under 'view/album/album' the html files corresponding to my actions like add or index.

I'm using a submodule and the standard loading won't find my html-files. I followed this guide for setting a custom template path. This works for the index because here I use a ViewModel instance.

But my add/delete/edit actions just return an array like this one.

Is there a way to tell Zend that it should use a different directory to look for the views?

PS: I also tried this injectTemplate approach but no luck. It just sets the Controller namespace/path which is ok in my case.

回答1:

This was an project specific issue...

I used MasterData as top namespace. When creating the directory tree in my module\MasterData\view I wrote masterdata instead of master-data. This caused the not finding of my views.

A dumb one... I know.