Edit on GitHub

{% flash %}

The {% flash %} and {% endflash %} tags will render any flash messages stored in the user session, set by the Flash PHP class. The message variable inside will contain the flash message text and the markup inside will repeat for multiple flash messages.

    {% flash %}
        <li>{{ message }}</li>
    {% endflash %}

You can use the type variable that represents the flash message type — success, error, info or warning.

{% flash %}
    <div class="alert alert-{{ type }}">
        {{ message }}
{% endflash %}

You can also specify the type to filter flash messages of a given type. The next example will show only success messages, if there is an error message it won't be displayed.

{% flash success %}
    <div class="alert alert-success">{{ message }}</div>
{% endflash %}

Setting flash messages

Flash messages can be set by Components or inside the page or layout PHP section with the Flash class.


function onSave()
    // Sets a successful message
    Flash::success('Settings successfully saved!');

    // Sets an error message
    Flash::error('Error saving settings');

    // Sets a warning message
    Flash::warning('There was a problem but no worries');

    // Sets an informative message
    Flash::info('Just a heads up about the settings');

Keep informed

Sign up to our newsletter to receive updates on Winter CMS releases, new features in the works, and much more.
We'll never spam or give this address away.

Latest blog post

Winter: 16 Months Later

Published July 14, 2022
With the first year of Winter behind us, let's take a look at what we were able to achieve in 2021.

View this post Read all posts

Latest Winter CMS release


Released October 20, 2022
14 UX/UI Improvements, 25 API Changes, 33 Bug Fixes, 4 Security Improvements, 5 Translation Improvements, 1 Performance Improvement, 2 Community Improvements, 2 Dependencies, 0 New Contributors * @cstorus made their first contribution in https://github.com/wintercms/winter/pull/616 * @simonmannsfeld made their first contribution in https://github.com/wintercms/winter/pull/623 * @quangtrongonline made their first contribution in https://github.com/wintercms/winter/pull/636 * @nathanlesage made their first contribution in https://github.com/wintercms/winter/pull/665 * @vllvll made their first contribution in https://github.com/wintercms/winter/pull/669 * @robertalexa made their first contribution in https://github.com/wintercms/winter/pull/668 * @iamyigitkoc made their first contribution in https://github.com/wintercms/winter/pull/624 * @hecc127 made their first contribution in https://github.com/wintercms/winter/pull/682 * @prsuhas made their first contribution in https://github.com/wintercms/winter/pull/723

View details View all releases