Bukocen
Bukocen

Reputation: 51

Zend passing data from action in controller to view in another controler

How can I pass data from action in controller to view in another controller? From action in controler to view in the same controller is easy: I simply write in action's function :

$this->view->assign('error', 'Wrong login');

and in view I recieve it in this way:

<?=$this->escape($this->error);?>

but how can I do it to receive it in view of another controller?

Upvotes: 0

Views: 1473

Answers (1)

Renato Aquino
Renato Aquino

Reputation: 814

I might be wrong but my guess is that for every request there is only one Zend_View, so if you set something on ControllerA and forward execution to ControllerB you could access that data in the same way.

It´ll not work if you use the action helper _redirect because it´s a browser redirection, to just forward execution to another "place" use the _forward helper instead.

Another option is the flashMessenger helper, that a look at the docs

http://framework.zend.com/manual/en/zend.controller.actionhelpers.html

Upvotes: 0

Related Questions