I need to loop through categories and then the top stores within each of the categories, and being relatively new to MVC I've unsure as to how to accomplish this in keeping with the MVC principles.
At the moment I was planning on doing something like this, but now I look at it I see an awful lot of stuff which I feel should be in the model:
My Controller looks like this:
public function category_list() {
foreach ($this->CategoryModel->getCategoryList() as $cat) {
$data['cat_title'] = $cat['category_title'];
$data['list']['stores'] = $this->StoresModel->getStoresByCategory($cat['category_id']);
$this->_Load->view('stores_by_category.tpl', $data);
}
}
Is this the right way around achieving this task or is my feeling of guilt correct?
Many thanks