Skip to content

Function buildSearch

Taufik Firmansyah edited this page Jan 29, 2015 · 4 revisions

This function used for filtering/search rows . using $_GET method with 'search' as get params via url browser . so if your url contain ?search= then function will automatic collect info from get value .

Example Usage

if browser url tell address

http://yourapp/yourmodule?search=FirstName:mario

then if you catch using buildSearch() function it will formating as following code

$filter= $this->buildSearch();
// result will be like 
" AND FirstName REGEXP 'mario' "

Adding conditional statment

Now what about if you want to add fixed filter into your query ? you can append current $filter .

$filter .= " AND Status = 'mario' ";

Module Structure

BaseController

BaseModel

SiteHelpers

Clone this wiki locally