Welcome Guest, Not a member yet? Register   Sign In
Load more than one instance of the same library
#2

[eluser]Pascal Kriete[/eluser]
CI includes the class, does some stuff, instantiates it, and stores that object reference in an array. What you get when you say $this->load is that reference. That's done so that you don't actually overwrite the instance when you use it in say a controller and later on in another library.

The easiest thing to do is to just make a new one. Remember, it's already included so all you do is:
Code:
$bla = new Name();

Alternatively you could add some sort of restore function to your class that you call to reset all class variables. That way you keep the CI benefits and get to reuse it. That doesn't work if you need multiple instances simultaneously, of course.


Messages In This Thread
Load more than one instance of the same library - by El Forum - 06-01-2008, 05:00 PM
Load more than one instance of the same library - by El Forum - 06-01-2008, 06:46 PM
Load more than one instance of the same library - by El Forum - 06-01-2008, 06:48 PM
Load more than one instance of the same library - by El Forum - 06-01-2008, 06:50 PM



Theme © iAndrew 2016 - Forum software by © MyBB