如何让模块使用应用程序视图助手?
由于向 zend 框架应用程序添加一些额外的模块,会出现很多错误。默认情况下,所有额外的模块都倾向于使用相同的布局文件来渲染 html,但对于视图帮助,它会搜索它自己的文件夹。
就我而言,我制作了一个视图助手来加载某些模板的 css 文件。我将其命名为 LoadTemplate
并将其放入 APPLICATION_PATH."/view/helpers"
它工作得很好,直到我浏览到模块。然后它给出一个错误,说它
Plugin by name 'LoadTemplate' was not found in the registry; used paths: Custom_View_Helper_: x/x/application/modules/custom/views\helpers/ Zend_View_Helper_: Zend/View/Helper/
正在错误的文件夹中搜索。
我们不能告诉它首先搜索其文件夹,如果找不到,则从默认或应用程序的视图助手中查找助手吗?
Since, adding some extra modules to the zend framework application, a lot of errors are popping out. By default, all the extra modules tend to use the same layout file to render a html, but for view helpes, it searches it's own folder.
In my case, I made a view helper, to load some template's css file. I named it LoadTemplate
and placed it inside APPLICATION_PATH."/view/helpers"
It works perfectly, until I browse to a module. Then it gives a error saying
Plugin by name 'LoadTemplate' was not found in the registry; used paths: Custom_View_Helper_: x/x/application/modules/custom/views\helpers/ Zend_View_Helper_: Zend/View/Helper/
It is searching in the wrong folder.
Can't we tell it to search its folder first, and if not found go and find the helper from the default or Application's View Helper?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的助手位于该目录中,请确保它名为
Zend_View_Helper_LoadTemplate
,函数名为loadTemplate
,文件名为LoadTemplate.php
编辑-
另请查看 Rob Allen 的博客文章:http://akrabat.com/zend-framework/view-helpers-in-modules/
If your helper is in that directory, make sure it is called
Zend_View_Helper_LoadTemplate
, the function is calledloadTemplate
and the file name isLoadTemplate.php
Edit -
Also check out this blog post by Rob Allen: http://akrabat.com/zend-framework/view-helpers-in-modules/