Revision #5 has been created by g3ck0 on Nov 9, 2010, 4:58:28 PM with the memo:
Highlighted the DON'Ts, added "encapsulated in methods" in Controller section
« previous (#4)
The controller should contain code for collecting user input, retrieving models from the database, and rendering views.
In a controller there should
- HTML code: HTML should be in the view
- SQL code: If needed, SQL should be in a model
- Field names: Field names should be in the view
[...]HTML code should only be in views.
- User input (e.g. $_GET and $_POST): Input should be collected in models in the controllers, never in views.
[...]Models are used for collecting user inputs, and accessing the database.
In models there should
- User input ($_GET, $_POST): You should write a function that will be called in the controller.
- HTML: HTML should be in a view