views:

898

answers:

1

In our application, we have certain scenarios where we'd like to perform a redirect and pass a long string to the next controller/action. I'm familiar with both of these:

$this->_redirect('/controller/action?string=thisistheverylongstring);

But would like to avoid showing the user the string as part of the URL.

Throwing the string in $this->view doesn't help because after a redirect, a new request is created.

As far as I know, using $this->_helper->redirector() has the same problem.

+2  A: 

I'm not super familiar with ZF's controller system so I can't give you a bespoke recommendation.

Is using a session value out of the question? Another popular framework, symfony, uses what they call "flash" variables which are session values that survive for only 1 more request.

I'm sure you could do something similar with ZF.

Peter Bailey
Thanks for the info. There is a FlashMessenger class in ZendFramework.http://framework.zend.com/manual/en/zend.controller.actionhelpers.html#zend.controller.actionhelpers.flashmessenger
Chris Williams
Well awesome. Glad my answer pointed you in the right direction.
Peter Bailey