Wednesday, January 4, 2012

Access view inside custom view helper

To access the view instance from your homemade view helper you just need to create a setView method and view property. This will be automatically called upon instantiation, setting the view variable to point at the view instance.

Example:

class Zend_View_Helper_Navigate {
 
 public $view;
 
     function setView($view){
 
         $this->view = $view;
     }
 
 
 function navigate(){
  //more helper code
 }
}

No comments:

Post a Comment