Using multiple libraries together? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Using multiple libraries together? (/showthread.php?tid=31389) |
Using multiple libraries together? - El Forum - 06-17-2010 [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. Using multiple libraries together? - El Forum - 06-17-2010 [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 |