Difference between #4 and #5 of
Code style

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
[...]
29 0
7 followers
Viewed: 28 511 times
Version: 1.1
Category: Tips
Tags: mvc
Written by: zaccaria
Last updated by: g3ck0
Created on: Nov 9, 2010
Last updated: 14 years ago
Update Article

Revisions

View all history