Welcome Guest, Not a member yet? Register   Sign In
Converting an app to CI (conceptualizing the breakdown)
#4

[eluser]Mirage[/eluser]
Well, from an MVC point of view you have a few things in the wrong place. While CI allows it, your view file has way too much business logic in it.

Try this:

1. From the controller call your Model to fetch the menu structure
2. In the Model, run all the queries you need to build up the menu and 'model' the complete result e.g. into a nested array or similar. Return that completed structure to the controller.
3. From the controller pass this menu structure to the view.
4. In the view unroll the data in a loop/nested loop.

The model is where it all happens. The controller is just a traffic cop and the view just a [dumb] presentation of your data.

Cheers!


Messages In This Thread
Converting an app to CI (conceptualizing the breakdown) - by El Forum - 06-17-2008, 10:42 AM
Converting an app to CI (conceptualizing the breakdown) - by El Forum - 06-17-2008, 01:17 PM
Converting an app to CI (conceptualizing the breakdown) - by El Forum - 06-17-2008, 10:52 PM
Converting an app to CI (conceptualizing the breakdown) - by El Forum - 06-18-2008, 08:08 AM
Converting an app to CI (conceptualizing the breakdown) - by El Forum - 06-19-2008, 12:51 AM
Converting an app to CI (conceptualizing the breakdown) - by El Forum - 06-19-2008, 02:18 AM
Converting an app to CI (conceptualizing the breakdown) - by El Forum - 06-19-2008, 02:31 AM
Converting an app to CI (conceptualizing the breakdown) - by El Forum - 06-19-2008, 09:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB