Skip to content

Commit

Permalink
[#5808] Language tweaks as a I read - Javier improves my language, th…
Browse files Browse the repository at this point in the history
…en I tweak things a little further :)
  • Loading branch information
weaverryan committed Nov 5, 2015
1 parent d9ff31e commit ef7061f
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions book/controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -605,12 +605,11 @@ Flash Messages
~~~~~~~~~~~~~~

You can also store special messages, called "flash" messages, on the user's
session. By design, flash messages are meant to be processed exactly once. This
means that they vanish from the session automatically as soon as they are
retrieved. This feature makes "flash" messages particularly suited for storing
user notifications.
session. By design, flash messages are meant to be used exactly once: they vanish
from the session automatically as soon as you retrieve them. This feature makes
"flash" messages particularly great for storing user notifications.

Consider the following form processing example::
For example, imagine you're processing a form submission::

use Symfony\Component\HttpFoundation\Request;

Expand All @@ -635,19 +634,19 @@ Consider the following form processing example::
}

After processing the request, the controller sets a flash message in the session
and then redirects. The message key (``notice`` in this example) can be freely
chosen and is used to retrieve the message content.
and then redirects. The message key (``notice`` in this example) can be anything:
you'll use this key to retrieve the message.

In the template of the next page (or even better, in your base layout template),
the following code will render the messages stored under the ``notice`` key:
read any flash messages from the session::

.. configuration-block::

.. code-block:: html+jinja

{% for flashMessage in app.session.flashbag.get('notice') %}
{% for flash_message in app.session.flashbag.get('notice') %}
<div class="flash-notice">
{{ flashMessage }}
{{ flash_message }}
</div>
{% endfor %}

Expand Down

0 comments on commit ef7061f

Please sign in to comment.