-- pat <[EMAIL PROTECTED]> wrote
(on Thursday, 28 February 2008, 07:42 PM -0600):
> I've run into a problem.  I am moving much of my action controller logic
> into viewhelpers and I
> have come across a fragment that no longer seems to work after the
> transplant.
>
>            $this->_redirector =
> $this->_helper->getHelper('Redirector');
>            $this->_redirector->gotoUrl('/error/condition);

Right -- because '$this' as above was referring to the action
controller, and now you're in the view object, which has very different
methods.

> Is there an easy way to redirect from a viewhelper?

Yes -- very similar to the above, but pulling directly from the action
helper broker:

    $this->_redirector = 
Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
    $this->_redirector->gotoUrl('/error/condition');

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to