Notice
class. However,
this can also be done from the Resource Res
class. This makes it easier to set up or display flash messages.
The three (3) main methods of the Notice class are setFlash()
, Flash()
and
hasFlash()
.
The following are ways by which the flash can be applied to web applications.
$name = 'Foo'; if($name == 'Foo') { Res::setFlash('notice', 'I found a Foo'); } if( Res::hasFlash('notice') ) { print Res::flash('notice'); }
setFlash()
method. The existence
of a flash (key) can also be tested by using the hasFlash()
method while
Res::flash()
returns the value of a specified key.
Res::setFlash()
method, the flash can
be imported using the flash()
directive in template files to call the flash key
name. The flash will only be displayed once it exists.