Welcome Guest, Not a member yet? Register   Sign In
Variable that points to a library class?
#1

[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();

#2

[eluser]Aken[/eluser]
You can assign your own property name when loading a class.

Code:
$this->load->library('webservice_a', NULL, 'myservice');

// Access it with:
$this->myservice->loadstuff();




Theme © iAndrew 2016 - Forum software by © MyBB