Skip to content

Instantly share code, notes, and snippets.

@jmolivas
Created October 25, 2012 18:00
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmolivas/3954344 to your computer and use it in GitHub Desktop.
Save jmolivas/3954344 to your computer and use it in GitHub Desktop.
Twig template code - Displaying flash messages using bootstrap
{# twig template #}
<div class="flash-messages">
{% block flashes %}
{% for notice_level in ['success','error','info', 'warning', 'notice'] %}
{% if app.session.hasFlash(notice_level) %}
<div class="alert alert-{{ notice_level }}">
<a class="close" data-dismiss="alert" href="#">x</a>
<h4 class="alert-heading">{{ notice_level }}</h4>
{{ app.session.flash(notice_level) }}
</div>
{% endif %}
{% endfor %}
{% endblock flashes %}
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment