Retrieving Notifications
Generally you should only retrieve notifications from oi within a view. This will mean if a redirect is triggered in your controller any alerts will be retained in the session and displayed in on the next page.
$this->oi->messages()
Call messages to return all alerts in the session as a string
$this->oi->messages();
If you only wish to return messages of a given type, set the first parameter.
$this->oi->messages('success');
Finally, once a notification has been returned it will automatically be removed from the session unless the second parameter is set to TRUE
// return all success messages but keep them in the session
$this->oi->messages('success', TRUE);
// return all messages and keep them all in the session
$this->oi->messages(NULL, TRUE);