Book Image

CodeIgniter for Rapid PHP Application Development

By : David Upton
Book Image

CodeIgniter for Rapid PHP Application Development

By: David Upton

Overview of this book

<p>CodeIgniter (CI) is a powerful open-source PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. CodeIgniter is an MVC framework, similar in some ways to the Rails framework for Ruby, and is designed to enable, not overwhelm.<br /><br />This book explains how to work with CodeIgniter in a clear logical way. It is not a detailed guide to the syntax of CodeIgniter, but makes an ideal complement to the existing online CodeIgniter user guide, helping you grasp the bigger picture and bringing together many ideas to get your application development started as smoothly as possible.</p>
Table of Contents (21 chapters)
CodeIgniter for Rapid PHP Application Development
Credits
About the Author
About the Reviewers
Preface
Index

The CRUD Model: Design Philosophy


The idea behind this CRUD model is that it can be called by any controller for any table. The data about that table, and how you want its update form displayed is held once, in an array. Everything else is standard: the controller just identifies itself (and thereby the table it acts on) and if necessary, gives an ID number for a record. So all you have to do is write a few simple controllers, and all the work of setting out forms and making database connections is done for you.

Remember that the user can't talk to a model directly, so (s)he has to go through a controller every time. You could put all the code in the controller, but then you'd have to copy it all for each new controller. This way, there is only one set of CRUD code in the model, so only one set to update and maintain. The price is that you have to keep passing information backwards and forwards between controllers and model, which makes the code slightly more difficult to follow.

For the...