Welcome Guest, Not a member yet? Register   Sign In
Using multiple libraries together?
#1

[eluser]diggersworld[/eluser]
Hello,

I have two libraries which I need to get to work together.

The first one EWPServices.php I can get to run fine. I load and use it in a controller using the following code.

$this->load->library('EWPServices');
$this->ewpservices->function();

Now here's where I'm stuck. Within the EWPServices function I call it needs to use a different library's function (PPCrypto.php). I've loaded the library in the controller along with EWPServices, but when I use $this->ppcrypto->function(); from within the EWPServices library I get a call to member function on non-object error.

It's probably something really simple, so if anyone could point it out, I would greatly appreciate it.

Cheers,
Thomas.
#2

[eluser]diggersworld[/eluser]
I've figured it out... I added the following in my library.

public $CI;

public function __construct()
{
if (!isset($this->CI))
{
$this->CI =& get_instance();
}
}

Then called the function like this:
$this->CI->ppcrypto->signAndEncrypt




Theme © iAndrew 2016 - Forum software by © MyBB