Oi


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);

$this->oi->has_messages()

The has_messages method can be used to check if there are any messages awaiting display.

This is useful if you would like to wrap messages in a container:

<? if($this->oi->has_messages('')):?> 
	<div class="oi-wrapper">
		<? echo $this->oi->messages(NULL)?>
	</div>
<? endif?>