How to include one view in to another view in zend framework:
IndexController.php :
public function articleAction(){
$this->view->content = $this->_model->getContent();
$this->view->comments = new Zend_view;
$this->view->comments->addBasePath('/full/path/to/views');
$this->view->comments->comments = $this->_model->getComments();
$output = $this->view->render('index.phtml');
print $output;
}
index.phtml :
<?= $this->comments->render('comments.phtml'); ?>
comments.phtml :
<?php foreach($this->comments as $comment){ ?>
<span><?= $comment->title ?></span>
<p><?= $comment->text ?></p>
<?php } ?>