Variable that points to a library class? - 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: Variable that points to a library class? (/showthread.php?tid=57353) |
Variable that points to a library class? - El Forum - 03-08-2013 [eluser]JackU[/eluser] How can i do this so it works? I wan´t the $myservice variable to point to the loaded webservice. if ($message=="a") { $this->CI->load->library('webservice_a'); $myservice = $this->CI->webservice_a; } else { $this->CI->load->library('webservice_b'); $myservice = $this->CI->webservice_b; } $data = $myservice->loadstuff(); Variable that points to a library class? - El Forum - 03-08-2013 [eluser]Aken[/eluser] You can assign your own property name when loading a class. Code: $this->load->library('webservice_a', NULL, 'myservice'); |