CodeIgniter approaches web development with MVC in mind. MVC is a way of presenting data that keeps programme logic and presentation separate from each other. This means that there is little PHP scripting in your presentation pages, keeping them clean and focused on looks.
MVC stands for Model, View, Controller with each being used for a specific function.
Models are typically where your programme will interact with the database e.g. inserting, updating and retreiving data.
Views are where your HTML will go, this is what will make the logic you create look good. Views don’t have to be conventional web pages. In the examples I will be showing I will be loading just a part of the page the header. By doing this it keeps individual page content separate as the header remains the same across all pages.
Controllers act as the middle man. They are what connect the users requests to the relevant view and retrieve any other resources that are required. This will also be where you put all your programme logic such as iterating over records from database and validating user input from forms etc.
This may have been quite a short post, however, I feel that CodeIgniters MVC approach needed explaining and a quick overview of what each patrt is and what code goes where was necessary.
Head over to the next post to check out how to create our first controller and view. Here