Monday, 15 March 2010

php - How to develop a MVC framework from scratch? -


The view is different from MC,

but how to separate M and C? The difference seems a bit unclear to me.

I am using PHP.

The "model" portion of the MVC refers to the data access layer, so you can read / write from the database Should create a class for Often this is a model "unit" per unit, therefore, say, a class for articles, a class for categories, as well as a simple database class is a good idea.

The "controller" part is the general argument, and usually the entry point here, you check the input and requested page, use the model to find the right data and in the variable for the view.

As you said the "scene" part is quite easy. Simply include a file from the controller that contains most HTML but outputs to your PHP variable.


No comments:

Post a Comment