CakePHP: jQuery styling of flash messages
January 30th, 2009
CakePHP session flash messages is one of the most useful things for usability, and user notification. Trying to make it more fancy, I came to jQuery framework with its HighlightFade plugin.
Adding just a couple of lines, we can get nice effects, looking the same as Wordpress messages in Posting/Editing:
var $j = jQuery.noConflict(); //I'm using Prototype as well, so we don't need conflicts
$j(document).ready(function() {
if( $j("#flashMessage") ){
$j("#flashMessage").highlightFade({color:'#24F273',speed:2000, iterator:'exponential'});
}
});
Thus, next time you will pass $this->Session->setFlash('Foo');, your flash message with default
flash();?>
will be used with above HighLight effect.