[eluser]Pygon[/eluser]
xwero: technically, yes, the model structure should encapsulate application state (note, currently most people are looking at "model" as a single component and not as a structure of components that accomplish tasks.
Essentially, the model is fairly dumb in the grand scheme of things -- it simply takes requests, makes changes, stores data and returns it upon request. The controller structure determines flow but isn't really responsible for handling data (should all be handled in the model structure) and selects a view appropriate to the change made. The view simply requests application state and displays it.
"Application state" is probably a bit confusing to you, since in our application our models start fresh with every page change, but this more means the current state of our application (ie. this model holds on to that there was this error while processing).
How's about a sudo example:
Code:
User:: Request insert comment
Controller:: access->hasAccess()
? continue
: load->view('no_access','insert_comment') >> end
Controller:: validate->check()
? continue
: error->setError(1) >> load->view('error_comment') >> end
Controller:: comment->insert()
? load->view('success_comment') >> end
: error->setError(2) >> load->view('error_comment') >> end
View (error_insert):: error->getErrorType() >> lang->get(error) >> //Determine appropriate form and show it// >> end
View (success_insert):: lang->get('success') >> //Determine what should display and do it// >> end
In this example, the controller doesn't care what data changes, only whether it succeeded or failed. When it fails, it notifies the model structure that there was an error, then selects the view best suited to handle the results.
The view structure, based upon the view invoked and the data status (error or not), the view determines what should be displayed and how. The model doesn't care what is going to show up on the screen, and neither does the controller really (other than to let the view know the result of its action in the form of selecting a view).
This really isn't that far off from the way CI handles things. The difference is that most of the view structure and some of the model responsibilities are moved into the controller, and the view becomes essentially a template (due to the method of loading, although yes there are ways to work around it).