-- Steve Uplift <[email protected]> wrote (on Wednesday, 25 March 2009, 04:24 PM -0700): > Does anyone know how to correctly access a view's render method inside an > action helper? I have the following helper: > > class Custom_Helpers_Widgets extends Zend_Controller_Action_Helper_Abstract > { > > public function direct($widget) { > $response = $this->getResponse(); > $response->insert('widget1', $this->view->render($widget)); > } > } > > It's simple but ilustrates my problem easily enough. > > Then in my controller action: > > $this->_helper->widgets('mailinglist.phtml'); > > I get the error message: > > Fatal error: Call to a member function render() on a non-object in ....... > > I'm probably being stupid but I thought you were able to access a view > object in an action helper as if you were in the action itself.
$this->getActionController() will get you the action controller instance; you can then access any public members of the controller at that point. -- Matthew Weier O'Phinney Software Architect | [email protected] Zend Framework | http://framework.zend.com/
