Skip to content

Commit

Permalink
minor #3555 Wrap variables in {} for safer interpolation (ifdattic)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.3 branch.

Discussion
----------

Wrap variables in {} for safer interpolation

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | 2.3
| Fixed tickets |

Commits
-------

4046476 Replace double quotes with single quotes
0f7a189 Change interpolation to concatenation
d3839ce Wrap variables in {} for safer interpolation
  • Loading branch information
weaverryan committed Feb 16, 2014
2 parents 5f02bca + 4046476 commit f4bb017
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions components/http_foundation/sessions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Quick example::

// retrieve messages
foreach ($session->getFlashBag()->get('notice', array()) as $message) {
echo "<div class='flash-notice'>$message</div>";
echo '<div class="flash-notice">'.$message.'</div>';
}

.. note::
Expand Down Expand Up @@ -308,18 +308,18 @@ Simple, display one type of message::

// display warnings
foreach ($session->getFlashBag()->get('warning', array()) as $message) {
echo "<div class='flash-warning'>$message</div>";
echo '<div class="flash-warning">'.$message.'</div>';
}

// display errors
foreach ($session->getFlashBag()->get('error', array()) as $message) {
echo "<div class='flash-error'>$message</div>";
echo '<div class="flash-error">'.$message.'</div>';
}

Compact method to process display all flashes at once::

foreach ($session->getFlashBag()->all() as $type => $messages) {
foreach ($messages as $message) {
echo "<div class='flash-$type'>$message</div>\n";
echo '<div class="flash-'.$type.'">'.$message.'</div>';
}
}

0 comments on commit f4bb017

Please sign in to comment.