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


Okay, here are a few examples that will help put everything together.

Filtering a search

When you filter a search, the following events take place:

  1. The user visits the site and CodeIgniter routes them to the shop controller. The shop controller loads the index() function

  2. The index() function recognizes that there is no third parameter in the URL, so it calls the get_all_products() function of Shop_model.

  3. The index() function loads the get_all_categories() function of Shop_model, passing the retuned result to $data['cat_query']. This is passed to the views/shop/display_products.php file, which—using a foreach loop—echoes out the categories.

  4. The user clicks on a category in the list. The URL calls the index() function, but this time with a third parameter.

  5. The index() function recognizes this third parameter and loads the get_all_products_by_category_name() function of Shop_model, passing it the third uri segment.

  6. The get_all_products_by_category_name() function of Shop_model...