user3740742
user3740742

Reputation: 51

ZF2: How to render view from other module

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?

Upvotes: 0

Views: 863

Answers (1)

Exlord
Exlord

Reputation: 5371

you need to use partial view helper

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

Upvotes: 1

Related Questions