[eluser]diez[/eluser]
What i want to do:
i want to be able to create multiple instances of a class (model or library) but as well be able to pass custom parameters (or an array of variables) to the model or library while using CI's framework.
My problem:
I seems like i can create multiple instances of a using a model, as such:
Code:
$this->load->model('Model_name', 'cat');
$this->load->model('Model_name', 'dog');
$this->load->model('Model_name', 'rat');
$this->cat->function();
$this->dog->function();
$this->rat->function();
now, i want to be able pass in a third parameter, as such:
Code:
$arr_cat_specs = array('height'=>'1 foot', 'weight'=>'5lbs', 'colour'=>'white');
$this->load->model('Model_name', 'cat', $arr_cat_specs);
however, in the model documentation is says the third parameter is used to configure database settings.
Now if i were to use a library class, i can submit parameters with custom data, as such
Code:
$params = array('type' => 'large', 'color' => 'red');
$this->load->library('Someclass', $params);
however i can't seem to create multiple instances like i can with a model.