Hi,
I created a new class called Status, which is used to show notification messages. It works, when I redirect the page (the notif. shows up), but when I only set the message it won't show p on the same page (I don't redirect the page.)
The class
class Status {
public static $_status = array();
public static $_new = array();
final private function __construct() {
}
public static function _init() {
static::$_status = Session::get_flash('status', array());
return true;
}
public static function get($type = null) {
if ($type and array_key_exists($type, static::$_status)) {
return static::$_status;
} else {
return static::$_status;
}
}
public static function set($status = null, $type = 'success') {
if ($status) {
static::$_new[$type][] = $status;
static::save();
return true;
}
return false;
}
private static function save() {
Session::set_flash('status', static::$_new);
return true;
}
}
I don't what the problem is. Is it possible the show it on the same page?
Thanks
You are right, but the flash is set on the previous page. It should be accessible on the actual page, shouldn't it?
Does my class load before the session class? I defined the load in the config.
I can't comment on that, I can't see your code.
If you "Always load" your classes, it should be loaded before the Session class. Session is not loaded by default, the first method call will trigger the load.