From 3c45f140f0982a9dc582667761443b6e907ef21c Mon Sep 17 00:00:00 2001 From: Jitendra Joshi Date: Thu, 7 May 2015 12:34:52 +0530 Subject: [PATCH] Added Alert component example Flash message example with Alert bootstrap component. close #8311 --- docs/guide/runtime-sessions-cookies.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/guide/runtime-sessions-cookies.md b/docs/guide/runtime-sessions-cookies.md index 68f7a427fc..606450af2e 100644 --- a/docs/guide/runtime-sessions-cookies.md +++ b/docs/guide/runtime-sessions-cookies.md @@ -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