Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
I'm going to explain MVC at only a very high level as this courses focus is on CodeIgniter . For a more comprehensive description I recommend MVC Frameworks for Building PHP Web Applications with Drew Falkman here in the lynda.com online training library. MVC stands for Model-View-Controller. It's a software design pattern that separates the representation of information from user interaction. This explicit separation of components allows for greater code reusability and logical separation of program responsibilities.
In short MVC keeps code organized, which in turn helps projects and teams. CodeIgniter uses a loose approach to MVC which I'll get into more detail in a bit. There are three components to MVC. The first, model is the representation of data structures, business rules, and functions. This is where really basic, create, read, update, and destroy or CRUD functionality is defined. Next is a View, which is a representation of the information that's presented to the user. The View is where all HTML rendering takes place.
The most program logic that's in a View is a really simple if, then, like if something exists then display it. Anything that takes more logic than that, like deciding what to do based on user input, is delegated to the controller, which serves as kind of an intermediary between the model and the view. The controller sends commands to the other components like model, save yourself, then view, show a message saying that the model was saved. As a visual explanation of a regular interaction, a site user will send a command to the controller which will in turn manipulate the model, like create this record, for example. Through which the control updates the View with a confirmation that the record has been updated.
The User sees the final HTML representation in the View. Earlier, I mentioned that CodeIgniter uses a loose approach to MVC. To be clear, CodeIgniter's use of models is unique and does not precisely fit in traditional definition within a model MVC design patterns. They're more like a domain object, which is a collection of properties. Models in Codelgniter are optional. Depending on your project needs, you can completely leave it out, leaving only a minimal application with just controllers and views. I'm going to demonstrate Codelgniter's implementation of models. Now that we've got this theory out of the way, let's start building an application by installing the Codelgniter framework.
Get unlimited access to all courses for just $25/month.Become a member
61 Video lessons · 99162 Viewers
56 Video lessons · 112438 Viewers
71 Video lessons · 81253 Viewers
131 Video lessons · 39021 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.