Welcome Guest, Not a member yet? Register   Sign In
understanding Models
#1

[eluser]jtan[/eluser]
I noticed that most of the time, I can run the code without actually using Models, the data can be loaded directly from Controller, what's the advantage of using Models?
#2

[eluser]WanWizard[/eluser]
If you want to can put all code is a single method in a single controller, CI is so flexible it won't stop you.

You will have to use some discipline and determine for yourself which implementation of the MVC pattern works for you. Using models and libraries, and dedicating a controller method to a single task, makes your application simple, structured, and easy to maintain.
#3

[eluser]jtan[/eluser]
can I assume models are more like extensions or libraries for Controllers?
#4

[eluser]jtan[/eluser]
any trick how to track data, sometimes i get confused with so many variables/data to pass from controller to model to views...
#5

[eluser]WanWizard[/eluser]
[quote author="jtan" date="1280068759"]can I assume models are more like extensions or libraries for Controllers?[/quote]
You normally use the controller to control the flow, use libraries for shared and/or reusable methods, and models to interact with your data.
#6

[eluser]WanWizard[/eluser]
[quote author="jtan" date="1280069004"]any trick how to track data, sometimes i get confused with so many variables/data to pass from controller to model to views...[/quote]
I don't now what you want to track.

I usually start defining my 'data' array at the begining of my method, then add elements to it as I get along, until I reach the point where I call the view, to which I pass the data array.




Theme © iAndrew 2016 - Forum software by © MyBB