Welcome Guest, Not a member yet? Register   Sign In
Converting DateTime Type to MM/DD/YYYY
#11

[eluser]Skulls[/eluser]
as i see it, he is using the result from the database, in the view...
now because this is an MVC the model and the view are always connected by the controller, so the linking part you are talking about is always present. for using this result in other views in different format, you can make the function in the model flexible adding parameters to it and serving the data as you wish for needed cases.
#12

[eluser]xwero[/eluser]
If the display of the date needs to be changed it is less intuitive to have to do it in the controller or the model than in the view. If a designer wants to change the display of the date you don't want him to wade through the controller code?
#13

[eluser]Skulls[/eluser]
i was talking for the programmer point of view, for the designer to change data extracted is another problem and in my opinion the designer should have nothing to do with the backside of the site.
why would you want a designer to run through the programmer's code and change it? even in a view... he should only change the position of the generated data in the page... but that is my opinion, being used to backside and frontside development
#14

[eluser]xwero[/eluser]
The designer example was to emphasize that the date formating belongs in the view. If you put the date format in the controller are you not moving a view responsibility to the controller?
#15

[eluser]Skulls[/eluser]
it's a matter of how you are used to code, how you organize the code structure, what is the size of the project you are working at..., how many people work on the same application, etc. many factors come into choosing the code separation in an MVC style application... now because it's an MVC you don't have to strictly maintain that style, but you should agree with the team (if there are many people working on the project) on that style you choose. it's a big decision in the end, and for experienced developers it's taken by their style and past experience, or by the project leaders... this is a big subject anyway Smile hope you understand what i'm saying...
again, in my opinion, the formating of the dynamic data should stay outside of the view... (more html than php), but there are situations where it's easier to fill the view with a lot of dynamic formating.
#16

[eluser]Kesey[/eluser]
Thanks for all of the responses and interesting discussion. I was already loading the date helpers so I went with the below code and it does exactly what I need.

Code:
<? $date_to_echo = date('M d', mysql_to_unix($row->post_date));?>

Thanks again!
#17

[eluser]xwero[/eluser]
In the end you are right saying CI doesn't force you to choose their MVC implementation. Like i said you presented another option than mine and both are valid. Both options have their own consequences and it is that what i'm trying to bring forward in our dialog.




Theme © iAndrew 2016 - Forum software by © MyBB