I had a model that had an unrelated class defined inside of it.
I was prototyping and didn't spend time to create it properly.
Now that the prototype was accepted by my end users, I'm revisiting and I would like to reorg my code properly. The class looks something like this:
<?php
class myclassABC
{
private $_hostname;
private $_password;
private $_username;
private $_connection;
private $_data;
private $_timeout;
private $_prompt;
public function __construct($hostname, $password, $username = "", $timeout = 10)
{
$this->_hostname = $hostname;
$this->_password = $password;
$this->_username = $username;
$this->_timeout = $timeout;
} // __construct
public function connect()
{
}
public function dosomethingelse()
{
}
}//end class
I've moved all this code into a separate file, and this file is now in my libraries folder. But i'm having problems figuring out how to properly instantiate an object in my model. I tried:
//pass all the data we need as an array of parameters.
$params = array('_hostname' => '$ip', '_password' => 'password', '_username' => '');
$hp = $this->load->library($classname,$params );
$hp->connect();
$data= $hp->dosomethingelse();
$hp->close();
It's loading the right class, but I'm getting the following error message:
Severity: Warning
Message: Missing argument 2 for HP5406_ssh::__construct(), called in /var/www/m.racktables/system/core/Loader.php on line 1095 and defined
Filename: libraries/HP5406_ssh.php
Line Number: 22
Argument two is the password.
Sorry, this is my first attempt at using libraries with codeigniter.
if you could provide some suggestions, it'd be appreciated.