Added Alert component example

Flash message example with Alert bootstrap component.

close #8311
This commit is contained in:
Jitendra Joshi
2015-05-07 12:34:52 +05:30
committed by Carsten Brandt
parent 0b3e139dc3
commit 3c45f140f0

View File

@ -230,6 +230,15 @@ $alerts = $session->getFlash('alerts');
find sometimes you are getting an array while sometimes you are getting a string, depending on the order of
the invocation of these two methods.
> Tip: For displaying Flash messages you can use [[yii\bootstrap\Alert|bootstrap Alert]] widget in the following way:
>
> ```php
> echo Alert::widget([
> 'options' => ['class' => 'alert-info'],
> 'body' => Yii::$app->session->getFlash('postDeleted'),
> ]);
> ```
## Cookies <span id="cookies"></span>