Book Image

CodeIgniter Web Application Blueprints

Book Image

CodeIgniter Web Application Blueprints

Overview of this book

Table of Contents (16 chapters)
CodeIgniter Web Application Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Putting it all together


Now that we have made all the amendments to configuration files, created the database, and created all the files necessary for the app to work (controllers, models, views, and so on) let's run through a few scenarios briefly, just to make sure we know how the app functions.

Creating a shortened URL

Let's consider an example where Lucy visits the URL Shortener app and the create controller is called by CodeIgniter, displaying the create/create.php view file. The following is the sequence of events:

  1. Lucy enters a URL in the text input and clicks on Shorten Now.

  2. Upon submitting the form, the controller validates the URL. The URL is successfully validated and the validation returns no errors.

  3. The URL entered by Lucy is then sent to the save_url()function of Urls_model that creates a unique code. The save_url() function uses the PHP construct do while and an Active Record database query to create a unique code that doesn't already exist in the database.

  4. Once a code has been...