Thanks, that's perfect.
:)
On 19 Mar 2007, at 17:45, Matthew Weier O'Phinney wrote:
-- Nick Thornley <[EMAIL PROTECTED]> wrote
(on Monday, 19 March 2007, 05:24 PM +0000):
I'm trying to forward from within the init() function of a
Controller to an
action in a different controller, but it is only using the action
argument -
forwarding only within the current controller.
for example, in my class
firstController extends Zend_Controller_Action
I add into the init() method
$this->_forward('myAction','second'); //forward to
secondController::myAction
Then (provided the action doesn't exist in firstController) an
exception is
thrown showing:
firstController::myactionAction() does not exist
ie. It is just forwarding to the specified action within the current
controller. (The same thing occurs when specifying modules as well.)
If the code is anywhere other than init(), it works as you would
expect.
Have I missed something, and this is intentionally so by design,
or is it a
bug?
By design. init() is for object initialization -- primarily setting up
the action controller environment. The call to set the dispatched flag
happens *after* object instantiation, but *before* preDispatch() is
called. Hence, you'll want to run your code from your action
controller's preDispatch() method (or from a preDispatch() plugin).
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/