[TYPO3-50-general] Flash message API

Robert Lemke robert at typo3.org
Fri Jul 17 12:57:25 CEST 2009


Hi Francois,

Am 16.07.2009 um 21:04 schrieb Francois Suter:

> - an API to display the flash messages (which as far as I understand
> would be a Fluid view helper in v5)

Almost. Currently flash messages are "just available" as variables in  
a Fluid
template. We can still argue about that, but for now you add the  
following
to your Fluid template and it works:

<f:for each="{flashMessages}" as="message">
	<p class="bodytext"><strong>{message}</strong></p>
</f:for>

> - an API to manage a message queue.
>
> The latter is of course far more interesting. Are flash messages  
> managed
> just generally? Can they be tagged to be displayed only in certain
> places? Can they be stored in session, so that messages can be passed
> from one script to another in case of redirections? If yes, how is
> flushing managed?

Flash messages are stored in a session. Adding a new message is a  
matter of
the following call within your controller:

$this->pushFlashMessage($message);

On each request the controller will automatically pop all messages  
from the
stack and assign them to the "flashMassages" variable in the Fluid  
template.
Therefore all messages are cleared on the next request, even if you  
don't
display them. The popFlashMessages() method is not intended to be used  
by
the user / developer.

That's a very basic but also convenient approach, however I'm open to  
including
your ideas for improvement.

Cheers,
robert



More information about the TYPO3-project-5_0-general mailing list