Welcome Guest, Not a member yet? Register   Sign In
When to code in controller and when in views?
#1

[eluser]codeamanny[/eluser]
I have a Table which is being generated by my app.

Should looping through the data be done on the views side of the app?

or is it better to loop on the controller side and pass the resulting data plus html to the view as a variable?

Is there a good way of deciding which is the best way to implement for CI?
#2

[eluser]xwero[/eluser]
It is up to you, there is no good or bad way. Personally i like to keep all my html code in view files because then designers can see all the html but this means there is quite some code in the view files.
#3

[eluser]codeamanny[/eluser]
CI is really beautiful when you have a view file like

echo $beginform
echo $table (with form elements dynamically generated inside (WOW!)
echo $endform

SCREW the designers..., they don't mess with my masterpiece!....... Wink

I think I fell madly in love with CI tonight.. Its not perfect, but its got a lot of promise.
#4

[eluser]xwero[/eluser]
As long as you don't take CI to bed you'll be fine :lol:
#5

[eluser]adwin[/eluser]
I use CI combined with Freakauth and Smarty ... so simple and so wonderfull ...
I did all the logic in controller and all the beauty thing in views with Smarty Wink (actually i replace views with smarty code) I use smarty instead of pure php code so that my designer can work with it.




Theme © iAndrew 2016 - Forum software by © MyBB