MVC: Model View Controller -- does the View call the Model?

Posted by Gary Green on Stack Overflow See other posts from Stack Overflow or by Gary Green
Published on 2010-04-12T11:44:42Z Indexed on 2010/04/12 16:13 UTC
Read the original article Hit count: 471

I've been reading about MVC design for a while now and it seems officially the View calls objects and methods in the Model, builds and outputs a view.

I think this is mainly wrong.

The Controller should act and retrieve/update objects inside the Model, select an appropriate View and pass the information to it so it may display. Only crude and rudiementary PHP variables/simple if statements should appear inside the View.

If the View gets the information it needs to display from the Model, surely there will be a lot of PHP inside the View -- completely violating the point of seperating presentation logic.

© Stack Overflow or respective owner

Related posts about mvc

Related posts about php