[eluser]skunkbad[/eluser]
[quote author="Sire" date="1260266595"]What about having the model pass the data to the controller, the controller function will loop through the data passing it to a view which contains a snippet of the markup. The resulting data will then be passed through to your main view. Something like this:
controller function
- get $category_data['categories'] from model
- loop through the data ...
foreach($category_data['categories'] as $category) :
$data['categories'] .= $this->load->view('category_list_view',$category_data,TRUE);
endforeach;
- $this->load->view('main_template',$data);
Your views contain all the markup this way, and your controller has all the code.[/quote]
Some people will say that the markup, however small, doesn't belong in the view. I do think it matters, because if it didn't then there'd be no point in trying to follow the MVC pattern. Will somebody shoot at me for doing it my way? Probably.