Module 4 – Working with MVC

Model – View – Controller

MVC is a software approach that separates application logic from presentation.

The Model represents your data structures. Typically your model classes will contain functions that help you retrieve, insert, and update information in your database.

The View is the information that is being presented to a user. A View will normally be a web page, but in CodeIgniter, a view can also be a page fragment like a header or footer.

The Controller serves as an intermediary between the Model, the View, and any other resources needed to process the HTTP request and generate a web page.




Example: Nationality table

Here is a detailed example of adding, updating and deleting in a simple table: Nationality table.

In 14 steps you will discover the relations between Model – View and Controller.

You can download the 7 pages example here. The modules are from MEB application and it would be easier to follow having the application code open in front of you.

MEB Structure

Now that you are more familiar with MVC, you will be interested to see how this method is used in MEB. In this document, you will discover all the forms as well as the list of controllers, models and views involved in the system.