Welcome Guest, Not a member yet? Register   Sign In
Views and PHP Code
#10

[eluser]Colin Williams[/eluser]
I think there are distinctions to be made between "application logic" and "display logic." Keeping roles clearly separated, the controller should do little "display logic", because this takes power away from the views.

So what's the solution, do both! Let's say I have a blog app and there are areas where one expects to see a list of blog posts. Where do you loop. You can send an array to the view and have it loop, or you can loop from the controller, calling a view on each iteration, and send the result to the view. Or, you can do both. Pass the array and the rendered iterative result to the view. The "designer" can either template each iteration in the view that is called multiple times, or get "fancy" and iterate from the "parent" view. Best of both worlds.


Messages In This Thread
Views and PHP Code - by El Forum - 02-01-2009, 12:25 PM
Views and PHP Code - by El Forum - 02-01-2009, 01:03 PM
Views and PHP Code - by El Forum - 02-01-2009, 01:54 PM
Views and PHP Code - by El Forum - 02-01-2009, 01:57 PM
Views and PHP Code - by El Forum - 02-01-2009, 02:11 PM
Views and PHP Code - by El Forum - 02-01-2009, 07:36 PM
Views and PHP Code - by El Forum - 02-01-2009, 07:48 PM
Views and PHP Code - by El Forum - 02-01-2009, 08:49 PM
Views and PHP Code - by El Forum - 02-01-2009, 09:00 PM
Views and PHP Code - by El Forum - 02-01-2009, 10:15 PM
Views and PHP Code - by El Forum - 02-01-2009, 10:32 PM
Views and PHP Code - by El Forum - 02-01-2009, 11:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB