[eluser]lukeinjax[/eluser]
I'm trying to figure out the best way to handle showing results from a database. I know that I could retrieve the results from the model from within the controller and then pass the whole results set to the view, but then I would have looping logic in my view, which somewhat violates the purpose of MVC.
My other option would be to break the view up into several small pieces and call them via $this->load->view('someview') in the controller as I loop through the results. The only problem with this is that if (for example) I wanted to show the results in a table, I would need to have the beginning of the table in one view, then a separate view that would be called for each row within the loop in the controller, then another view to close the table.
I'm wondering which of these solutions the CI community would use, or if I'm missing something all together. I'm also wondering about the performance implications of both solutions and trying to figure out which would be more efficient. One involves passing a potentially large object around (not sure if CI does this by reference or value) and the other involves loading a view over and over again. Again, I'm not sure how CI handles this. Does the view get cached while the script is executing, or is it actually loaded fully each time?