Reputation: 869
I am using Codeigniter message library.
In my controller I have the following code
public function __construct() {
parent::__construct();
$this->load->library('message');
}
public function box($box_id=null, $language_name=null) {
if($id_from_url[5]==null){
$this->message->set('Please provide Box ID in URL.', 'error');
}
}
In my view I use
$this->message->display();
I have already put Message.php in my application/libraries folder but I am getting the following error
Message: Missing argument 1 for CI_Message::CI_Message(), called in W:\Zend\Apache2\htdocs\mediabox\system\core\Loader.php on line 1099 and defined
Any idea about this error ?
Thanks in advance
Upvotes: 0
Views: 7161
Reputation: 3794
Your title is completely different than the error you are getting here. It clearly states that the Message library requires a parameter passed to its construct, but you are loading the library without any construct parameters.
You need to pass the construct parameters using the second parameter while loading it
$this->load->library('message',$config);
If you are actually talking about this Message library here http://codeigniter.com/wiki/Message then I must say, the documentation there is incomplete.
function CI_Message($config){
$this->CI =& get_instance();
$this->CI->load->library('session');
if($this->CI->session->flashdata('_messages')) $this->messages = $this->CI->session->flashdata('_messages');
if(isset($config['wrapper'])) $this->wrapper = $config['wrapper'];
}
The construct here requires a parameter $config
passed to it.
Check the documentation thoroughly. You need to pass this while loading it.
$config = array();
$config['wrapper'] = array('<div id="messages">', '</div>');
then
$this->load->library('message',$config);
Upvotes: 1