zend view render如何解析查看脚本的路径
像“customSearchAction()”这样的操作如何映射到视图脚本文件名。
这些文件名都不起作用“customsearch.xml.phtml”、“customSearch.xml.phtml”、“custom-search.xml.phtml”。
请注意,我正在使用 xml、json 的上下文切换视图助手。此外,模块和操作正在正确解析。当我将操作名称更改为“customsearchAction()”并将脚本文件重命名为“customsearch.xml.phtml”时,它就可以工作。
那么上述情况下视图脚本文件名是如何解析的呢?在 Zend 框架中
How does an action like this "customSearchAction()" map to the view script file name.
Neither of these file names work "customsearch.xml.phtml", "customSearch.xml.phtml", "custom-search.xml.phtml".
Please, note that I am using context switching view helper for xml, json. Also, the module and action are resolving properly. When I change the action name to "customsearchAction()" and name the rename the script file to "customsearch.xml.phtml", then it works.
So how is the view script file name resolved in the above case? in the Zend Framework
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自文档:
因此,
custom-search.phtml
是正确的名称。现在您可能存储它的目录有误,控制器名称(和模块)是什么?还要检查您是否看到 apache 可以读取脚本。编辑
在使用 ContextSwitch 的情况下:
$contextSwitch->addActionContext('custom-search', 'xml');
>custom-search.xml.phtml
刚刚在 ZF 1.6 上测试了它(旧但应该仍然有效)。所以也许你的初始化是错误的(使用'customSearch'而不是'custom-search'?)。
From documentation:
So, from that
custom-search.phtml
is the right name. Now you are maybe wrong with the directory where you store it, what's the controller name (and module)? Check as well you view script is readable by apache.Edit
In the case of ContextSwitch usage:
$contextSwitch->addActionContext('custom-search', 'xml');
custom-search.xml.phtml
Just tested it on a ZF 1.6 (old but should still be valid). So maybe your initialization is wrong (used 'customSearch' instead of 'custom-search'?).