View is easy to be separated from MC,
but how to separate M and C?The difference seems a little vague to me.
I’m using PHP.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The “model” part of MVC refers to the data access layer, so you should create classes to read from/write to the database. Often it’s one model per database “entity”, so, say, one class for articles, one class for categories, plus a simple database class is a good idea.
The “controller” part is the general logic, and usually the entry point. Here you check the input and requested page, use the model to find the correct data and store in variables for the view.
The “view” part as you said is quite easy. Just include a file from the controller that mostly consists of HTML but outputs your PHP variables.