Chapter 1. Welcome to the MVC World

This book is about CodeIgniter and the world of Model-View-Controller (MVC) web development. Before venturing into the topic of CodeIgniter, it's helpful to put it into some kind of context. However, most programmers who are new to the world of MVC web development find some of the concepts hard to grasp at first — they've been so engrained in the old way of doing things that unlearning is difficult at first.

So even before you can learn anything about CodeIgniter or even MVC, it's probably helpful to start the discussion with something you already know and understand, and then move on from there. Therefore, that's where this book begins: with a description of a prototypical PHP project, most likely very similar to anyone's very first PHP project.

Many PHP programmers learn PHP either as their first language (having only been exposed to XHTML and CSS beforehand) or after learning another similar language (such as Perl). Most of the time, a PHP programmer's first few projects involve a pretty steep learning curve, but eventually the programmer finds a comfortable groove. He ends up with a project consisting of the following components:

  • A series of PHP pages with intermingled PHP commands, SQL queries, and XHTML

  • A series of JavaScript and CSS files that are linked from those PHP pages

  • A series of universal includes — a footer file for all pages and a header file that contain the database connection and session initialization code

  • A handful of database ...

Get Professional CodeIgniter® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.