Difference between
#4 and
#5 of
Code style
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)
Changes
Title
unchanged
Code style
Category
unchanged
Tips
Yii version
unchanged
Tags
unchanged
mvc
Content
changed
[...]
### Controller
The controller should contain code for collecting user input, retrieving models from the database, and rendering views.
In a controller there should **never
** be:
- HTML code: HTML should be in the view
- SQL code: If needed, SQL should be in a model
, encapsulate in methods.
- Field names: Field names should be in the view[...]
HTML code should only be in views.
Views should **not
** contain:
- 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 **not
** be:
- User input ($_GET, $_POST): You should write a function that will be called in the controller.
- HTML: HTML should be in a view[...]