Welcome Guest, Not a member yet? Register   Sign In
FlashNotice Helper - EZ to use and Sexy too
#1

[eluser]Andy Blackwell[/eluser]
Download it from the WIKI page
Preview Image

Time for me to contribute back to the community! So here's my first attempt...

For those that use or would like to use those one-time informational messages that display after an action of some type (like success, error, warning, info), I've made a helper for them.

Autoload the helper and now anywhere in your app you can add messages with this syntax:
Code:
FlashNotice::add('Your message goes here', 'error');
// the second parameter is an optional message type which can be
// any of the predefined values (info, success, warning, error)
// defaults to 'success'

Use those throughout your app and the helper stores them all in a Session var 'FlashNotice'

Then to diplay it in your view (preferably place this in a template header or something, so you only have to write it once)
Code:
FlashNotice::display();
// if there are any messages it will compile and display them,
// then destroy the Session var that stored them.
// otherwise it won't print anything to the page

I have created a default look and feel for the display. To use it, just include the folder with the Css and images, and include the stylesheet in your html.

I included an example of javascript code to utilize the close buttons on the box, and make the FlashNotice disappear from the page. You could also turn it into a modal box with a few tweaks if you wanted.

Hope some people find it useful.

As is, it's PHP5 only, since I used some things like private and static methods...sorry PHP4'ers!

Download it from the WIKI page


Messages In This Thread
FlashNotice Helper - EZ to use and Sexy too - by El Forum - 10-27-2007, 06:51 PM
FlashNotice Helper - EZ to use and Sexy too - by El Forum - 10-28-2007, 02:11 AM
FlashNotice Helper - EZ to use and Sexy too - by El Forum - 10-28-2007, 02:47 AM
FlashNotice Helper - EZ to use and Sexy too - by El Forum - 10-28-2007, 05:46 AM
FlashNotice Helper - EZ to use and Sexy too - by El Forum - 10-28-2007, 02:15 PM
FlashNotice Helper - EZ to use and Sexy too - by El Forum - 01-24-2008, 01:40 AM
FlashNotice Helper - EZ to use and Sexy too - by El Forum - 01-27-2008, 05:59 PM
FlashNotice Helper - EZ to use and Sexy too - by El Forum - 10-13-2008, 11:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB