Flash is a modest widget that allows you to render web user flash messages easily.
A newer version of this extension, TbAlert, is now part of my Bootstrap extension.
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) :
$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.
Understood what this extension is intended for as soon as I saw your example.
Nice extension, good job :-)
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...
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'.
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
A newer version of this extension, BootFlash, is now part of my Bootstrap extension.
Bootstrap can be found here:
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.