如何在 Zend 中使用不同模块的部分视图?
我正在尝试从另一个模块 bar 访问 foo 中的部分视图。简化的文件结构:
application/
modules/
foo/
index.phtml
bar/
partial.phtml
在 index.html 中,您将拥有以下代码:
<?php echo $this->partialLoop('../bar/partial.phtml', $this->paginator);
echo $this->paginator; ?>
问题是您实际上无法使用父遍历,因为我收到此错误:
Requested scripts may not include parent directory traversal ("../", "..\" notation)
有没有办法仍然包含我的内容页面的部分视图? (或者我做错了?)提前致谢。
I'm trying to access a partial view in foo from another module bar. Simplified file structure:
application/
modules/
foo/
index.phtml
bar/
partial.phtml
And in index.html you would have the following code:
<?php echo $this->partialLoop('../bar/partial.phtml', $this->paginator);
echo $this->paginator; ?>
The problem is that you can't actually use parent traversal, as I get this error:
Requested scripts may not include parent directory traversal ("../", "..\" notation)
Is there any way to still include the partial view into my content page? (Or am I doing it wrong?) Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要传递模块参数:
You need to pass the module argument:
我也经历过同样的问题。
我必须将一个模块的视图包含到另一个模块的视图中。
我通过在视图的控制器中添加脚本路径(我必须在其中包含另一个视图)解决了这个问题
,然后将脚本包含在视图文件中:
I have gone through the same issue.
I had to include views from one module into another module's views.
I have solved the issue by adding the script path within the controller of the view (in which I had to include the other view)
and then included the script within the view file: