Running multiple models from a single controller |
[eluser]JoostV[/eluser]
I really like what I've seen from CI and would like to use it! But, being a total newbie to CI I thought I might ask. What is the most efficient way to implement multiple models from a single controller? In a non-CI way of programming I call different models from my controller index.php. Most of them are the same for every http request, so I hard code them into the controller. One of them is dynamically retrieved from the URI. Typically, I end up with something like this: Code: $main = new main(); // Load all the core classes, open database connection, etc. How would you go about doing a thing like this in CI? Build a single controller in application/controllers and load different models from application/models?
[eluser]Craig A Rodway[/eluser]
Have a look at theses User Guide pages to get a feel of how Code Igniter handles: controllers and models.
[eluser]xwero[/eluser]
Code: class Someclass extends Controller
[eluser]JoostV[/eluser]
Thanx guys, I guess I read through the models section in the user manual too hastily. Sorry about that. Makes a lot of sense, this approach. |
Welcome Guest, Not a member yet? Register Sign In |