Welcome Guest, Not a member yet? Register   Sign In
Calling an instance of a class from itself.
#5

[eluser]Taff[/eluser]
Hey,
that was just some pseudo code to give you an idea.

I want to call a function that has a method in it which contains a loop.

In this loop I would like to create 1 instance of the same class per loop.

So when the class is first called with a parameter (e.g. 10)

Code:
$CI =& get_instance();
$CI->load->library("MatchingNode",10);

It will provide $CI->matchingnode with a number of variables depending on the value of the parameter passed, for example a text description, it's parents, a link, and some other odds and ends which it retrieves from the database.it also looks in the database for everything which is a child of 10 (lets say it has the children 12, 15 & 18).

I now have all this information for $CI->matchingnode including an array of children.

I now want to loop through the array and create a new instance of matchingnode which will do exactly the same...so it will create a new instance along the lines of

Code:
$CI->load->library("MatchingNode",12);
$CI->load->library("MatchingNode",15);

&

Code:
$CI->load->library("MatchingNode",18);

and upon doing so will generate the information I need for these children too...AND it will also check to see if these children have children of their own....and if so, carry on looping.

But how can I call more than one instance of a library item?

I hope someone can understand what I need now.

Thanks,
Taff


Messages In This Thread
Calling an instance of a class from itself. - by El Forum - 07-31-2008, 05:26 AM
Calling an instance of a class from itself. - by El Forum - 07-31-2008, 05:30 AM
Calling an instance of a class from itself. - by El Forum - 07-31-2008, 06:36 AM
Calling an instance of a class from itself. - by El Forum - 07-31-2008, 06:57 AM
Calling an instance of a class from itself. - by El Forum - 07-31-2008, 07:42 AM
Calling an instance of a class from itself. - by El Forum - 07-31-2008, 07:46 AM
Calling an instance of a class from itself. - by El Forum - 07-31-2008, 07:55 AM
Calling an instance of a class from itself. - by El Forum - 07-31-2008, 09:03 AM



Theme © iAndrew 2016 - Forum software by © MyBB