Flash is a modest widget that allows you to render web user flash messages easily.
Deprecated ¶
A newer version of this extension, TbAlert, is now part of my Bootstrap extension.
Usage ¶
To set up the widget you simply need to download the extension, place it in your application's extensions folder (create it under protected if it doesn't exist).
Rendering the widget is easy, you need to add the following code snippet to your main layout (Assuming you placed the extensions under /protected/extensions/flash) :
<?php $this->widget('application.extensions.flash.Flash', array(
'keys'=>array('success','error'),
'htmlOptions'=>array('class'=>'flash'),
)); ?><!-- flashes -->
After you've configured the widget it will display your flash messages.
Good solution
Understood what this extension is intended for as soon as I saw your example.
Nice extension, good job :-)
thank you..
very nice extension.. thank you Chris83 for the nice extension. Help me so much.. but just curious, how about to show error message with the different class?.. i still using the default blueprint css, it use different class for success and error...
@peterjkambey
You need to set the correct category when setting the flash message and then configure yii-flash to display that category. By default the error category is called 'error'.
thank you..
hi Chris83,
but, I put this widget in my main.php, so it became my main notification both success and error...
What about ajax messages
Does this extension work out of the box with AJAX flash messages? For example, deleting something in a cGridView.
Moved to Bootstrap
Hey All,
A newer version of this extension, BootFlash, is now part of my Bootstrap extension.
Bootstrap can be found here:
http://www.yiiframework.com/extension/bootstrap/
BootFlash is now TbAlert
BootFlash has evolved to TbAlert which is a part of the Bootstrap extension.
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.