model/view/controller logic |
[eluser]marc0[/eluser]
Hey, just getting into codeIgniter, what a great platform ! Here's the situation : I have a controller that gets real-estate listings (properties) from a listings table Now I have another table, containing open houses infos. So in my properties controller: -- Code: $data['proprietes'] = $this->model_proprietes->get_proprietes($config['per_page'], $offset); Now i need to add openhouse infos to the listings. The only way I can think of getting every open houses would be like this inside my properties view : Code: foreach ($properties as $p) { Thit just looks like horrible MVC programming to me... any suggestions ?!
[eluser]marc0[/eluser]
Here's what I was looking for, all done inside the controller. Code: $properties = $this->db->get('properties')->result();
[eluser]jmadsen[/eluser]
Use a database join. If you have formatting issues, try working with underscore.php or similar. Here's a quick tut I wrote to show how easy it is & how much performance you can save: http://www.codebyjeff.com/blog/2012/08/n...rscore-php (Today seems to be "Plug my Blog Day" :-) ) |
Welcome Guest, Not a member yet? Register Sign In |