Welcome Guest, Not a member yet? Register   Sign In
General question: Seperate controller or a function???
#5

[eluser]Jelmer[/eluser]
Best practice is the latter.

If you wonder if an action belongs in a view or not, the rule of thumb is: is it about presentation or are you manipulating your data?
When you're manipulating the data it should go into the controller. When it's about presentation it should go into the view.

Putting it into a table is a presentational decision, in addition to which you which might need CSS classes or ID's, and those are presentational concerns. So it should be generated in the view.
Another rule of thumb: there should never be any HTML in your controllers. Though I must admit I've taken some "short-cuts" in the past, I've almost always removed the HTML at a later time. That's also in part about maintaining and reading your own code: excising the HTML from your controllers makes you code a lot shorter and a lot easier to read.


Messages In This Thread
General question: Seperate controller or a function??? - by El Forum - 02-15-2010, 04:41 PM
General question: Seperate controller or a function??? - by El Forum - 02-15-2010, 05:27 PM
General question: Seperate controller or a function??? - by El Forum - 02-15-2010, 09:47 PM
General question: Seperate controller or a function??? - by El Forum - 02-16-2010, 04:43 AM
General question: Seperate controller or a function??? - by El Forum - 02-16-2010, 06:36 AM
General question: Seperate controller or a function??? - by El Forum - 02-16-2010, 07:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB