Welcome Guest, Not a member yet? Register   Sign In
Getting a loaded library instance: how?
#1

[eluser]Unknown[/eluser]
I want to load a library specified in a config file as a string. Since the name of the class can change, I do to not want to hardcode it.

Code:
$authclass = $this->config->item('authenticator');
$this->load->library($authclass);
I could refer to this library statically:
Code:
$this->authenticator->foo();
But. how can I refer to this library dynamically? Something like:
Code:
$this->$authclass->foo();
Alternatively, is there a way so that:
Code:
$auth = $this->load->library($authclass);
then you'd think either this would work:
Code:
$this->$auth->foo();
or this
Code:
$auth->foo();
Thanks.


Messages In This Thread
Getting a loaded library instance: how? - by El Forum - 11-06-2008, 10:46 AM
Getting a loaded library instance: how? - by El Forum - 11-06-2008, 11:42 AM
Getting a loaded library instance: how? - by El Forum - 11-06-2008, 11:45 AM
Getting a loaded library instance: how? - by El Forum - 11-06-2008, 12:54 PM
Getting a loaded library instance: how? - by El Forum - 11-06-2008, 01:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB