Where to put what ------------------
Many time,writing widgets or editing Giicode, there can be the doubt ifthe code is following the MVC patter or not. Afew suggestion can helpto detectedthe most evident error of style.### Controller In thecontroller thereshould be thecode for collectuser input, retrivemodels from database, rendering views. In a controller there should never be: - html code (itshould be in the view)- sql code (thereshould never be, if is needed it should stayin a model)- field name theyshould be in the view.Avoiding embedding field names allowyou to change the database with minimal effort.### Views In the views (and only in the views) thereshould be the html code. In the view thereshould not be:- user input ($_GET, $_POST)input should be collected in models in the controllers, never in views. - sql code: ifis neede, betterto crete functionsin the modelsThe less php operationthere are in the views, the bestit is. Instead of concatnate 2fields, is better to write a getter method, so you can reuse in other views. ### Models The models are used for collect user inputs and access to the database. Inthe 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)Widgets ------------------ Widgets hasa behaviorsimilar to controllers. If a widget is supposed to create lot of html,better to create a view file for it.