In this tutorial you will learn about the CodeIgniter MVC Framework and its application with practical example.
CodeIgniter MVC Framework
CodeIgniter follows Model-View-Controller (MVC) design pattern, which offers great separation between application, business and presentation logic. The following picture depicts the codeigniter MVC architecture –
CodeIgniter Model
In MVC framework, the letter “M” stands for Model. Model are means to handle the business logic in any MVC framework based application. Model is a class that represents the logical structure and gives you the way to retrieve, insert, and update information into your data table. In CodeIgniter, a model usually contain functions that help you retrieve, insert, and update information in your database.
All of the CodeIgniter Models are stored in the application/models directory.
CodeIgniter Controller
In MVC framework, the letter “C” stands for Controller. Controller works as an intermediary between the Model, View and any other resources required to process the HTTP request, it receives the incoming HTTP requests and process it communicating with models and views, then return the results back to the web browser. In CodeIgniter, controllers is completely responsible for handling the application logic.
In CodeIgniter, all of the controllers stored in application/controllers directory.
CodeIgniter View
View is one of the key component in any Model-View-Controller(MVC) framework.Views are meant to hold the presentation logic in any codeigniter
application. Views separates presentation logic from the application logic. A view file usually contains the information being presented to a user. View can be a complete web page or parts of page like header and footer.
In CodeIgniter, views are stored in application/views directory.