Mrz
10
2010
10
2010
sub-view in zend framework, use a view in a view
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 } ?>
Related Posts
Leave a comment
sideblog
- replace your plesk favicon (god damn it!)
- Convert all applicable characters to Numeric entities for use in XML
- Drupal Fatal error: Call to undefined function field_file_load() in /home/johannes/workspace/drupal/sites/all/modules/filefield/filefield_field.inc on line 97 with php 5.3
- smashing magazine forum closed - poor call
- disillusioning results for using telekoms developer garden ip location service
tags
2010 ai analytics api app attachment barcamp bash berlin boss compressor conference css drupal filter finder google helper howto image js manual menu minify node options pagepath php plugin regexp search studivz unconference user experience uxcamp view wordpress wp xml x of y yahoo yui zend zend framework Zend_Gdata
An article by Hannes

















![Super Mario Supermarket of the Day: Awesome stock boy is awesome.
[reddit.] Super Mario Supermarket of the Day: Awesome stock boy is awesome.
[reddit.]](http://c0382052.cdn.cloudfiles.rackspacecloud.com/dz3hwo_s.jpg?1281352245)