mirror of
https://github.com/bcit-ci/CodeIgniter.git
synced 2025-02-20 11:13:29 +08:00
...
parent
a1bec08232
commit
3ae8782fc9
@ -4,13 +4,17 @@ To use it:
|
||||
1. save code below as "flash_helper.php" into your applciation/helpers directory.
|
||||
2. load helper using $this->load->helper("flash");
|
||||
|
||||
- to set notice use setflash("Write notice","notice");
|
||||
- to set error use setflash("Write error information","error");
|
||||
- to display notices on the page use <?=flash();?> in your view.
|
||||
In your view:
|
||||
- To set notice:
|
||||
[code]setflash("Write notice","notice");[/code]
|
||||
- To set error:
|
||||
[code]setflash("Write error information","error");[/code]
|
||||
- To display notices on the page:
|
||||
[code]<?=flash();?>[/code]
|
||||
|
||||
You can use any other notice types in second parameter as this will result in class name of block element. Style #flash using CSS as you wish.
|
||||
|
||||
<?php
|
||||
[code]<?php
|
||||
function flash() {
|
||||
$flash = $_SESSION["flash"];
|
||||
unset($_SESSION["flash"]);
|
||||
@ -25,11 +29,11 @@ function flash() {
|
||||
function setflash($error="An error has occurred",$type="error") {
|
||||
return $_SESSION["flash"][$type] = $error;
|
||||
}
|
||||
?>
|
||||
?>[/code]
|
||||
|
||||
You may use script.aculo.us and Prototype to automatically hide notice after few seconds.
|
||||
|
||||
e.g.
|
||||
window.onload = setTimeout("new Effect.Fade('flash')",7000);
|
||||
[code]window.onload = setTimeout("new Effect.Fade('flash')",7000);[/code]
|
||||
|
||||
If you have any other ideas, please contact me at stefan@cleverleap.com or visit www.cleverleap.com.
|
Loading…
x
Reference in New Issue
Block a user