Welcome Guest, Not a member yet? Register   Sign In
Passing dynamic data to a view - help needed
#8

[eluser]tonanbarbarian[/eluser]
it depends on what you mean by raw processing

a view is supposed to be the presentation logic, so az view is supposed to take the data provided by the controller and present it in some format, mostly HTML
generally that can require looping through recordsets to display all of the data etc.

the things that fall into the grey area are whether any formatting on the data should be done in the view or in the controller or the model.

personally i do most of my formatting in the view because of the way i implement MVC

there is not hard and fast rule in CI how you implement the mvc
in fact in CI the only thing you MUST have is a controller, if you choose not to use models or views you can, but almost no one does this

The way I see MVC is...

Controller handle the business logic, i.e. they take a request from the user and decide how that is processed to give a result. This means taking data input by the user and passing it to models and then sending the resulting data from the model to the view where it is formatted for presentation to the user.

Models handle raw data. Create, Retrieve, Update and Delete. Models do not need to really know what the data is for or how it will be presented. Some simple formatting of data such as concatenation or substring of fields but no html formatting etc

Views present raw data in some format. Usually the format is HTML, but it could just as easily be CSV, XLS, PDF, JSON, XML or any other format you like.
This means I generally have a bit more PHP code in my view than some people may like, but some complex formatting can be done with helpers, such as creation of form fields, which helps resuce or simplify the php code in the view


Messages In This Thread
Passing dynamic data to a view - help needed - by El Forum - 10-27-2010, 06:15 PM
Passing dynamic data to a view - help needed - by El Forum - 10-28-2010, 02:46 PM
Passing dynamic data to a view - help needed - by El Forum - 10-28-2010, 06:11 PM
Passing dynamic data to a view - help needed - by El Forum - 10-28-2010, 06:13 PM
Passing dynamic data to a view - help needed - by El Forum - 10-28-2010, 06:16 PM
Passing dynamic data to a view - help needed - by El Forum - 10-28-2010, 06:55 PM
Passing dynamic data to a view - help needed - by El Forum - 10-28-2010, 07:22 PM
Passing dynamic data to a view - help needed - by El Forum - 10-28-2010, 07:41 PM
Passing dynamic data to a view - help needed - by El Forum - 10-29-2010, 04:32 AM



Theme © iAndrew 2016 - Forum software by © MyBB