zend-framework - 如何在 Zend 中使用来自不同模块的局部 View ?

标签 zend-framework zend-view

我正在尝试从另一个模块栏访问 foo 中的部分 View 。简化的文件结构:

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)

有没有办法将部分 View 仍然包含在我的内容页面中? (或者我做错了吗?)提前谢谢。

最佳答案

您需要传递模块参数:

<?php echo $this->partialLoop('partial.phtml', 'bar', $this->paginator); ?>

关于zend-framework - 如何在 Zend 中使用来自不同模块的局部 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5600147/

相关文章:

zend-framework - 如何在 Zend Framework 中设置多个布局。例如。公开/登录/多种模块组合

zend-framework - 使用 Zend 框架创建 PDF

php - 访问 Zend_Application_Bootstrap_Bootstrap 的 getOptions()

php - Zend 框架与 Kohana PHP 3

mysql - SQLSTATE[HY000] : General error: 1366 Incorrect integer value:

zend-framework - 将变量发送到 Zend Framework 中的布局

zend-framework - 如果父项和子项具有相同的 URI 并使用 Zend_Navigation,如何在菜单中呈现事件的父项和子项?

php - 如何删除 Zend 表单元素上的所有 DtDdWrappers 和标签

zend-framework - zend view render如何解析查看脚本的路径

php - 我在 Zend Framework 中的什么地方保存部分( View ),以便我的应用程序中的所有 View 都可以访问?