开发者

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-&g开发者_如何学运维t;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?


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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜