ZF2:如何从其他模块渲染视图 [英] ZF2: How to render view from other module
本文介绍了ZF2:如何从其他模块渲染视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在从其他模块渲染视图时遇到问题.
I have a problem with rendering view from other module.
例如:我在页面 news.phtml 上,我需要添加添加评论"页面.添加评论的视图在文件 add.phtml 中的其他模块评论"中.
For example: I'm on page news.phtml and I need to add 'Add comment' page. The view of adding comments is in other module 'Comments' in file add.phtml.
我不知道如何在新闻页面上包含此文件.我试过这样的事情:
I have no idea how to include this file on news page. I've tried something like this:
echo $this->render('module/Comments/view/comments/index/add.phtml');
echo $this->render('../../Comments/view/comments/index/add.phtml');
但没有任何效果.我怎么能这样做?
but nothing works. How could I do that?
推荐答案
需要使用partial
视图助手
echo $this->partial('comments/index/add');
这篇关于ZF2:如何从其他模块渲染视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文