<?php
$flash = $this->flashMessenger();

$icon  = '';
if($flash->hasInfoMessages())           $icon = '<icon class="icon fa fa-info"></icon>';
elseif ($flash->hasSuccessMessages())   $icon = '<icon class="icon fa fa-check"></icon>';
elseif ($flash->hasErrorMessages())     $icon = '<icon class="icon fa fa-ban"></icon>';
elseif ($flash->hasWarningMessages())   $icon = '<icon class="icon fa fa-warning"></icon>';

$flash->setMessageOpenFormat('<div%s style="padding:8px;margin-bottom: 5px;" id="alert-message">
    <button type="button" class="close" data-dismiss="alert" aria-hidden="true" style="right: 0px;">
        &times;
    </button>
    <p>'.$icon)
    ->setMessageSeparatorString('</p><p>')
    ->setMessageCloseString('</p></div><script>setTimeout(function(){$("#alert-message").alert("close")},5000);</script>');

echo $flash->render('error',   ['alert', 'alert-dismissible', 'alert-danger']);
echo $flash->render('info',    ['alert', 'alert-dismissible', 'alert-info']);
echo $flash->render('warning', ['alert', 'alert-dismissible', 'alert-warning']);
echo $flash->render('success', ['alert', 'alert-dismissible', 'alert-success']);


