In action, I set up some feedback for the user:
$this->getUser()->setFlash('message', array(
"type" => "notice",
"content" => "Well done buddy, you did it."
));
$this->redirect('home/index');
In the view, I just use the following code:
<?php if ($sf_user->hasFlash('message')): $message = $sf_user->getFlash('message') ?>
<p class="<?php echo $message["type"] ?>" ><?php echo $message["content"]?></p>
<?php endif; ?>
But the message never appears.
It’s not that the problem was not “it appears once, and then disappears”, because it will mean that it works. The problem is that it never appears. More than once.
I am using Symfony 1.2, so flash var is now bound to the user object.
source
share