开发者

How to disable view renderer from a controller action helper ?

开发者 https://www.devze.com 2023-03-20 17:48 出处:网络
In a controller, I can call viewRenderer helper like this : $this->_helper->viewRenderer->setNoRender(true);

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

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

How can I call viewRenderer i开发者_如何学JAVAn 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
   }
}


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(...);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号