It does work as you would expect - but you're obviously experiencing
issues. Try this.
function foo()
{
$this->Session->setFlash("Hello world");
$this->redirect('/', null, true);
}
On Jan 7, 11:57 pm, Ben Coleman <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm trying to use the session flash message with controller actions
> that redirect - with no luck.
> For example, if I have the following action defined in a controller
> called test:
> function foo()
> {
> $this->Session->setFlash("Hello world");
> $this->redirect('/');
> }
> This is redirecting back to my homepage (which via the default routing
> goes to pages/home) if try to display the flash in the view app\views
> \pages\home.thtml view it never appears (I'm using "$session->flash()".
> However if remove the redirect and let the action render
>
> it's view (app\views\test\foo.html) the flash message will appear OK
> in this view.
>
> What is wrong? The redirect seems to be consuming the flash message.
> This seems a big problem if you can't use the session flash with
> redirects; as I'd like to pass messages back to the user from viewless
> actions (such as delete)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---