Welcome Guest, Not a member yet? Register   Sign In
A New Understanding of CI
#3

[eluser]faceh[/eluser]
As a general rule of thumb (I agree with everything xwero said, but this is more condensed):

Controllers 'control' the data to be displayed
- ie. if's, else's, access checks, validation, etc.

Models are called by the Controller to grab database data.
- ie. anything involving SQL / mySQL / DB stuff goes in a model

Views simply display the data
- ie. they only do what they are told. No logic, if's or else's here


The following are my own opinions, which others may disagree with:

Libraries are used to process logic that may be used in more than one controller
- ie. Calculating a shopping basket total for display in different pages like basket, checkout and on the page sidebar

Helpers are like libraries but generally smaller and called by views
- ie. if you use the same layout in many views, rather than re-typing it every time, call it from a helper

Plugins - I have no idea Big Grin I would generally use libraries instead. Anyone offer a suggestion?


Messages In This Thread
A New Understanding of CI - by El Forum - 10-28-2007, 09:33 PM
A New Understanding of CI - by El Forum - 10-29-2007, 02:00 AM
A New Understanding of CI - by El Forum - 11-17-2007, 09:10 AM
A New Understanding of CI - by El Forum - 11-17-2007, 06:32 PM
A New Understanding of CI - by El Forum - 11-17-2007, 07:00 PM
A New Understanding of CI - by El Forum - 11-17-2007, 09:36 PM
A New Understanding of CI - by El Forum - 11-18-2007, 08:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB