All Codeigniter "library" constructors expect a single argument: an array of parameters, which are usually passed while loading the class with CI's loader, as in your example:
$params = array('type' => 'large', 'color' => 'red');
$this->load->library('Someclass', $params);
I'm guessing you're confused about the "Do something with $params" part. It's not necessary to pass in any params, but if you do you might use them like this:
class Someclass {
public $color = 'blue'; //default color
public $size = 'small'; //default size
public function __construct($params)
{
foreach ($params as $property => $value)
{
$this->$property = $value;
}
// Size is now "large", color is "red"
}
}
You can always re-initialize later like so, if you need to:
$this->load->library('Someclass');
$this->Someclass->__construct($params);
Another thing to note is that if you have a config file that matches the name of your class, that configuration will be loaded automatically. So for example, if you have the file application/config/someclass.php:
$config['size'] = 'medium';
$config['color'] = 'green';
// etc.
This config will be automatically passed to the class constructor of "someclass" when it is loaded.
$params = array('type' => 'large', 'color' => 'red'); $this->load->library('Someclass', $params);does it__constructmanually. I can't understand your question at all, of course you can pass in arguments to the constructor.