blob: 996745d657dc471e1b037f9bfd2239cf86b4db33 [file] [log] [blame]
Derek Jones8ede1a22011-10-05 13:34:52 -05001#####################
2Model-View-Controller
3#####################
4
5CodeIgniter is based on the Model-View-Controller development pattern.
6MVC is a software approach that separates application logic from
7presentation. In practice, it permits your web pages to contain minimal
8scripting since the presentation is separate from the PHP scripting.
9
10- The **Model** represents your data structures. Typically your model
11 classes will contain functions that help you retrieve, insert, and
12 update information in your database.
13- The **View** is the information that is being presented to a user. A
14 View will normally be a web page, but in CodeIgniter, a view can also
15 be a page fragment like a header or footer. It can also be an RSS
16 page, or any other type of "page".
17- The **Controller** serves as an *intermediary* between the Model, the
18 View, and any other resources needed to process the HTTP request and
19 generate a web page.
20
21CodeIgniter has a fairly loose approach to MVC since Models are not
22required. If you don't need the added separation, or find that
23maintaining models requires more complexity than you want, you can
24ignore them and build your application minimally using Controllers and
25Views. CodeIgniter also enables you to incorporate your own existing
26scripts, or even develop core libraries for the system, enabling you to
27work in a way that makes the most sense to you.