Welcome Guest, Not a member yet? Register   Sign In
Message Library
#1

[eluser]n0xie[/eluser]
Message Library

The CodeIgniter Message Library is a small, simple library to unify the way you pass messages to a view. It is largely a rewrite of Adam Jackett's message library to suit my personal needs. It allows for single, multiple or groups of messages. You can set a message to appear on the current page, or on the next page, such as after a redirect, or even after several redirects. It will only clear the message the moment it has been displayed.

You can change the way the message looks by adding a view partial with the same name as the message. If no named view is present, it will default to a default message view partial. If no default message view partial is present, it will try to fall back to a config file. If that isn't present it will just show the message without any markup, which might be preferable if you want to pass the message to javascript, in particular, something like a jQuery Growl plugin.

Basic usage

Set a message
Code:
$this->message->set('notice','this is just a notice');

Set an array of messages
Code:
$data = array(
  'message'=>'this is just a message',
  'notice'=>'this is just a notice'
);

$this->message->set($data);

Return all messages
Code:
$messages = $this->message->get();

Return a group of messages
Code:
$messages = $this->message->get('notice');

Show all messages
Code:
echo $this->message->display();

Show a group of messages
Code:
echo $this->message->display('notice');

I hope it is useful to someone, and let me know if you find any bugs or have any feature requests.

Download CodeIgniter Message Library


Messages In This Thread
Message Library - by El Forum - 04-16-2010, 08:01 AM
Message Library - by El Forum - 04-16-2010, 08:46 AM
Message Library - by El Forum - 04-16-2010, 09:02 AM
Message Library - by El Forum - 04-16-2010, 09:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB