Welcome Guest, Not a member yet? Register   Sign In
What is allowed in views exactly?
#3

[eluser]obiron2[/eluser]
in terms of what CAN be done in the view the answer is anything. - not very helpful I know.

In terms of what SHOULD be done it is probably easier to say what SHOULDN'T be in each part of MVC.

the view should not have to make any decisions about what to display; all of that should have been done in the controller. e.g. don't have the view decide whether to show the 'not logged in' message. Do that in the controller and pass a variable in the $data that indicates the page is not logged in (or redirect to a different view if that is more relevant)

The controller should not have any say in how the page is built, it should just decide which view to call and what information is required to generate it. Don't put HTML in your controller unless you absolutely have to. sometimes this can seem counter intuitive. e.g. as part of the FORM data your controller may need to tell the view which CSS class to use. The extension of this logic is that formatting helpers (FORM, TABLE, Calendar, etc) should all be called in the view as they help to render the data.

Obiron


Messages In This Thread
What is allowed in views exactly? - by El Forum - 01-28-2009, 09:06 PM
What is allowed in views exactly? - by El Forum - 01-28-2009, 10:58 PM
What is allowed in views exactly? - by El Forum - 01-29-2009, 06:49 AM
What is allowed in views exactly? - by El Forum - 01-29-2009, 04:40 PM
What is allowed in views exactly? - by El Forum - 01-29-2009, 05:35 PM



Theme © iAndrew 2016 - Forum software by © MyBB