ZF2: How to render view from other module

帅比萌擦擦* 提交于 2019-12-12 01:58:31

问题


I have a problem with rendering view from other module.

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?


回答1:


you need to use partial view helper

echo $this->partial('comments/index/add'); 


来源:https://stackoverflow.com/questions/24732452/zf2-how-to-render-view-from-other-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!