Welcome Guest, Not a member yet? Register   Sign In
Mysql Results Conditional
#5

[eluser]tonanbarbarian[/eluser]
because what you are trying to do is change the "presentation" of the data it should be done in the view

remeber MVC is about the 3 layers

business logic, i.e how to perform actions = Controller
data logic, i.e. how to interact with the data such as SELECT, INSERT, UPDATE, DELETE = Model
presentation login, i.e how to present the data taken from the model = View

You should always think about these things separately as well
The Controller should not know how the model gets the data, nor how the view presents it. The controller should just pass the data to the view and let the view determine how it should be displayed
The model should not know what the controller or view are going to do with the data, it should just process the data and return
The viewe should not care how the controller or model processed to give it data, it should just expect data in a mostly raw format and then present it somehow.

This approach of getting the view to do ALL formatting and presenting of the data is a bit more than most people do, and it also means that there is generally more PHP code in the view than some people like.
If you wish to reduce the PHP code in the view you can look at writing helper functions that help to process the display in the view as indicated above.

This is my take on how to do this, as indicated above it is just a guideline and you are not forced to do things this way. If you want you can make the change you want to the data in any of the controller, model or view. All I suggest is that you pick one approach and always follow that, at least in the same application.


Messages In This Thread
Mysql Results Conditional - by El Forum - 12-22-2010, 10:31 AM
Mysql Results Conditional - by El Forum - 12-22-2010, 11:11 AM
Mysql Results Conditional - by El Forum - 12-22-2010, 11:19 AM
Mysql Results Conditional - by El Forum - 12-22-2010, 09:26 PM
Mysql Results Conditional - by El Forum - 12-22-2010, 09:51 PM
Mysql Results Conditional - by El Forum - 12-23-2010, 08:26 AM
Mysql Results Conditional - by El Forum - 12-26-2010, 07:52 AM
Mysql Results Conditional - by El Forum - 12-26-2010, 07:57 AM



Theme © iAndrew 2016 - Forum software by © MyBB