2011年7月17日 星期日

Access view values from partialLoop

http://framework.zend.com/manual/en/zend.view.helpers.html

http://cogo.wordpress.com/2008/04/25/using-objects-with-zend_views-partialloop-helper/



http://www.hardcode.nl/archives_132/article_511-access-view-values-from-partialloop.htm


// in the view template:
$this->bla = 'blabla'; //value we will access
echo $this->partialLoop('imageviews/thumbnails.phtml',$this->searchResults);
 
//in the partialLoop template:
<?php echo $this->partialLoop()->view->bla // echo's blabla ?> 
 
 
//You can ofcourse also retrieve the view in the partialLoop as anywhere like this: 
$view = Zend_Layout::getMvcInstance()->getView();
 
 
//To  assign values to your layout object before the partial
$this->layout()->test = 'foo';
 
//and retrieve them using layout() inside the partialLoop template:
echo $this->layout()->test; // echoes 'foo'

沒有留言:

張貼留言