In my previous company which had an all-ajax web ap, there was a from-scratch framework being used. The way page sections refreshed was that you'd call the controller with a string, and the controller would load one or more view files. The view file would almost always call a class or classes in the model. This was as it was when I got there.
I am now working with a new company to develop a new system and looking at framework candidate. A 30 minute tutorial on codeigniter shows the controller calling the model, and the model loading the view.
This is opposite to what I am used to from my experience, so I wanted to ask which strategy is more common. In my mind it seems more rational that the view is a "shell" or structure but which is restricted to needing the model to get to the business rules.
I'm not sure if I should share a link here, I am NOT trying to promote codeigniter, but the tutorial is located at https://www.youtube.com/watch?v=47VOtKiw9AQ at about 10:00. Thanks
Site
which then does a->load('viewname')
. What I'm saying is, I've never seen that before. The structure I'm used to is, the view comes first, and references the model as necessary to get the data. Otherwise, with his tutorial, you are having to pass ALL your data to the view, which presumes you know more than the view does of what it needs - robbing it of its logical power - and in theory the view may have to reference the model AGAIN to get even more data if it needs to. To me, model->calling->view seems backward – Oliver Williams Mar 02 '15 at 15:15Site
, I was confusing that with the Model. We never had controller classes, only model classes (usually one per db table). So yes,Site
is the controller, and it is loading a view - not a "model" loading a view. – Oliver Williams Mar 02 '15 at 16:03