Zend Framework 2 - 设置模块的模板路径 [英] Zend Framework 2 - Set Template Path for Module

查看:226
本文介绍了Zend Framework 2 - 设置模块的模板路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我使用的是 tutorial-skeleton application 。它会自动在视图/相册/相册下面包含与添加或索引等操作相对应的html文件。



我使用的是子模块,找到我的html文件。我按照此指南设置自定义模板路径。这适用于索引,因为这里我使用 ViewModel 实例。



但是我的添加/删除/返回像这个一个



有没有办法告诉 Zend 它应该使用不同的目录对于视图?



PS:我也试过了 injectTemplate方法但没有运气。

解决方案

这是一个项目特定的问题...



我使用 MasterData 作为顶层命名空间。当在我的模块\MasterData \view中创建目录树时,我写了 masterdata 而不是 master-data 。这导致我没有找到我的意见。



一个蠢的...我知道。


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.

解决方案

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.

这篇关于Zend Framework 2 - 设置模块的模板路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆