[eluser]esra[/eluser]
[quote author="faceh" date="1195333824"]As a general rule of thumb (I agree with everything xwero said, but this is more condensed):[/quote]
I also agree wth xwero based on a CI point of view, but you need to realize that there are many implementations of MVC based on different development approaches. Rick Ellis generally takes a common sense point of view that is easily understood by anyone who is getting started with object-oriented programming. For anyone with experience working with alternate MVC implementations, CI is a bit of fresh air because Rick's development philosophy makes a great deal of sense. That is, Rick's approach is very intuitive to both the beginner and advanced developer.
[quote author="faceh" date="1195333824"]Controllers 'control' the data to be displayed
- ie. if's, else's, access checks, validation, etc.[/quote]
CI controllers are a bit passive. They load models, language files, plugins, helpers, and libraries, making those resources available to controller methods and the view. However, a CI controller does not mediate subcontrolers or a view.
[quote author="faceh" date="1195333824"]Models are called by the Controller to grab database data.
- ie. anything involving SQL / mySQL / DB stuff goes in a model[/quote]
Models do not necessarily have to load information from a database. For example, they could be used to handle the configuration file updates.
[quote author="faceh" date="1195333824"]Views simply display the data
- ie. they only do what they are told. No logic, if's or else's here[/quote]
Loader merely loads a file which is assumed to be a view based on the directory where the file is stored. However, it is fairly easy to subclass Loader.php to load templates from separate directories and partials (reusable views), from separate directories. For example, if you want to allow your users to switch between templates or allow a controller to load one of a selection of possible templates, it is possible to store those templates in a separate directory structure. Partials are view fragments. Some view fragments (parts of a template) are unique to a controller/view pair and are stored in views/. Some partials need to be reusable and loaded by multiple controllers. In a CMS like Postnuke or Xaraya, these are usually called blocks or modules in the case of Mambo/Joomla/Limbo. Blocks can be stored in a separate directory structure (e.g., under blocks). This makes it possible for the controller to load a selection of blocks.
[quote author="faceh" date="1195333824"]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[/quote]
It is possible to create a base controller from which all other controllers are inherited (extended). This base controller could include methods that are shared among multiple sibling (extended) controllers. However, it is wise to create libraries rather than a base controller when you need to selectively load classes with objects that are used by a subset of all controllers.
[quote author="faceh" date="1195333824"]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[/quote]
True, but unless a helper is autoloaded or loaded by a specific controller, it is not available to the view. In the case or a reusuable partial (view fragment or block), the partial or block could use a helper to use controller-like code (functions) for performing controller-like operations or for accessing database. Actually, it is possible for a reusable partial (e.g., a block) to have a dedicated helper which provides controller-like functions.
[quote author="faceh" date="1195333824"]Plugins - I have no idea

I would generally use libraries instead. Anyone offer a suggestion? [/quote]
Plugins are pretty much under utilized in CI. They are a file like a helper. The major distinction between a helper and plugin is the directory from which they are loaded. When used in conjunction with hooks, plugins could be used to integrate third-party libraries and applications with CI. This topic probably needs better explanation in both the wiki and user guide, allowing developers to use plugins more often.
WHAT HAS NOT BEEN MENTIONED are configuration files and language files. By default, a config/ directory is provided under application/ for storing application/core specific configuration files. What many users do not realize is that custom configuration files could be created for individual controllers and those configuration variables could be loaded by the associated controller into the CI super object.
A language/ directory can optionally exist under application/. Controller-specific language files can be loaded by a controller and the language strings could be used as constants in a controller which could be reused in views and within controllers.