0

In a controller, I can call viewRenderer helper like this :

$this->_helper->viewRenderer->setNoRender(true);

How can I call viewRenderer in a controller action helper? Assume that I have a Controller action helper :

class Zend_Controller_Action_Helper_Ajaxrequest extends Zend_Controller_Action_Helper_Abstract{

   public function test(){
       //what I should do here
   }
}
Omar
  • 8,374
  • 8
  • 39
  • 50
Nấm Lùn
  • 1,277
  • 6
  • 28
  • 48

1 Answers1

7

viewRenderer in your example is actually an action helper, not a view helper.

To call action helpers, use the helper broker:

$helper = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
$helper->setNoRender(true);

If you actually want to call view helpers, you need a view instance. You can get one from the controller:

$controller = $this->getActionController();

//call the url view helper
$controller->view->url(...);
Jani Hartikainen
  • 42,745
  • 10
  • 68
  • 86
  • Hello @jani, I tryed to call the view helper inside an action helper, but had no success with the code you posted, could you try to explain better the usage? Thanks. – digoferra Sep 08 '11 at 22:46