Last active
December 19, 2015 14:48
Revisions
-
ccagle8 revised this gist
Jul 11, 2013 . 1 changed file with 5 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -41,14 +41,12 @@ function display_messages() { <!doctype html> <html lang="en"> <head> <title>Twitter Bootstrap Messages</title> <!-- Dont forget to download and use your own copy --> <link href="http://twitter.github.io/bootstrap/assets/css/bootstrap.css" rel="stylesheet"> </head> <body> <?php display_messages(); ?> </body> </html> -
ccagle8 created this gist
Jul 11, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,54 @@ <?php /** * Display Alert Messages * * Looks for a global variable, and displays any test that variable has * * @uses GLOBALS $notice, $error, $success, $infonotice, $alertBlock * @return string */ function display_messages() { global $success; global $error; global $notice; global $infonotice; global $alertBlock; if ($alertBlock) $alertBlock = ' alert-block '; if ($notice) { echo '<div class="alert '.$alertBlock.'"><button type="button" class="close" data-dismiss="alert">×</button>'. $notice .'</div>'; } if ($error) { echo '<div class="alert alert-error '.$alertBlock.'"><button type="button" class="close" data-dismiss="alert">×</button>'. $error .'</div>'; } if ($success) { echo '<div class="alert alert-success '.$alertBlock.'"><button type="button" class="close" data-dismiss="alert">×</button>'. $success .'</div>'; } if ($infonotice) { echo '<div class="alert alert-info '.$alertBlock.'"><button type="button" class="close" data-dismiss="alert">×</button>'. $infonotice .'</div>'; } } # test the messages $error = 'Your payment has failed.'; $success = 'Your payment has succeeded!'; $notice = '<b>Tip:</b> When walking, you should have your eyes opened.'; $alertBlock = true; $infonotice = '<h4>Welcome!</h4><p>Thanks for signing up. Check out this <a href="">great tutorial</a> to get you started.</p>'; ?> <!doctype html> <html lang="en"> <head> <title>Twitter Bootstrap Messages</title> <!-- Dont forget to download and use your own copy --> <link href="http://twitter.github.io/bootstrap/assets/css/bootstrap.css" rel="stylesheet"> </head> <body> <?php display_messages(); ?> </body> </html>