Difference between #2 and #3 of
Code style

Revision #3 has been created by zaccaria on Nov 9, 2010, 11:43:49 AM with the memo:

« previous (#2) next (#4) »


Title unchanged

Code style

Category unchanged


Yii version unchanged

Tags unchanged


Content changed

### Controller

In the controller there should be the code for collect user input, retrive models from database, rendering views.

In a controller there should never be:

- html code (it should be in the view)
- sql code (there should never be, if is needed it should stay in a model)
- field name they should be in the view.
In the view there should not be:

- user input ($_GET, $_POST) input should be collected in models in the controllers, never in views.
- sql code: if is neede, better to crete functions in the models
In the models there should not be:

- user input ($_GET, $_POST)you should write a function that will be called in the controller.
- html code (it should be in the view)

29 0
Viewed: 24 992 times
Version: 1.1
Category: Tips
Tags: mvc
Written by: zaccaria
Last updated by: g3ck0
Created on: Nov 9, 2010
Last updated: 11 years ago
Update Article


View all history