Revision #4 was created by skworden on Mar 28, 2015, 4:16:19 PM.
checed for empty value. i uploaded this code to a shared server and it didn't like the shorthand the other way. this way works for both 5.4 and 5.5 php versions
Content
[...]
use Yii;
use yii\helpers\Html;
//Get all flash messages and loop through them
<?php foreach (Yii::$app->session->getAllFlashes() as $message):; ?> <?php
<?php
echo \kartik\widgets\Growl::widget([
'type' => (!empty($message['type'])) ? $message['type'] : 'danger',
'title' => (!empty($message['title'])) ? Html::encode($message['title']) : 'Title Not Set!',
'icon' => (!empty($message['icon'])) ? $message['icon'] : 'fa fa-info',
'body' => (!empty($message['message'])) ? Html::encode($message['message']) : 'Message Not Set!',
'showSeparator' => true,
'delay' => 1, //This delay is how long before the message shows
'pluginOptions' => [
'delay' => (!empty($message['duration'])) ? $message['duration'] : 3000, //This delay is how long the message shows for
'placement' => [
'from' => (!empty($message['positonY'])) ? $message['positonY'] : 'top',
'align' => (!empty($message['positonX'])) ? $message['positonX'] : 'right',
]
]
]);
?>
]
]);
?>
<?php endforeach; ?>
```
If you get any class not found errors please ensure you are using the proper "use" statements in your files at the top!
That’s all you have to do, enjoy!