Book Image

CakePHP 2 Application Cookbook

By : James Watts, Cake Software Foundation, Inc.
Book Image

CakePHP 2 Application Cookbook

By: James Watts, Cake Software Foundation, Inc.

Overview of this book

Table of Contents (20 chapters)
CakePHP 2 Application Cookbook
About the Authors
About the Reviewer

The Search plugin

Instead of manually doing the implementation of the searching and filtering in your models, you may be interested in using the CakeDC Search plugin, a powerful and reusable way to implement database search in your application.

In this recipe, we'll see how easy it can be to include the plugin within an application and add some search power on the fly.

Getting ready

First, we'll need to download and install the CakeDC Search plugin. We'll use git modules for the setup, but if you're not using git, you can simply download the ZIP file and place the contents of the plugin in a folder named app/Plugin/Search/, as shown in the following command:

$ git submodule add git:// app/Plugin/Search

After that, load the plugin in your bootstrap.php file, which is located in app/Config/, using the following code:


In this recipe, we're going to quickly build a search panel to filter our categories by their names (using LIKE) and by the...