[eluser]Unknown[/eluser]
I've been developing with CI for a few weeks now, but I'm running into some problems right now.
Usually I do this:
Code:
//Model Page
function getAllObjects()
{
$objects = {Query that fetches queries from my db};
$results = array();
foreach($objects as $r)
{
$o = new Object(); //Another model of mine
$o->getObjectUsed($r->id); //Get's the object type and content that is saved.
$results[] = $o;
}
return $results;
}
To explain what I'm getting at: I have a page with several area's that have objects assigned to them.
This unfortunately doesn't work. If I load the objects only the last object declared will be shown. It will be shown the X amount of times I get a result from the db. That's what CI does apparently and that is good, for the entire other part of my application anyway. But isn't there a way to deactivate that variable exchanging?
I mean how not useful is it to only be able to load one instance of the object class?
CI wise would be this I guess:
Code:
$this->load->model("Object","bla");
$this->bla->getObjectUsed($r->id);
$results[] = $this->bla;
But then $this->bla is not declared, I'm guessing because declaring a model load in model doesn't work.
Have I overlooked something? I read the entire user guide but that only helps so little when making the actual thing.
Help! It's driving me crazy...