Using DB_DataObject_FormBuilder, SearchBuilder can rapidly put together a search form and then use the submission to search the specified table(s). The results may either be printed in HTML or returned as an array of DataObjects. The main advantage of using something like this is speed and automation. Create the necessary DataObjects, joining if necessary using joinAdd() and then list the fields which should be searched. Extra search parameters may be added if required which map to where subclauses. SearchBuilder also uses the fb_linkDisplayFields attribute of your DataObjects to display foreign keys correctly. CSS Hooks are provided for the results table, so it can be customised to a certain degree.
Documentation and Demonstration to follow...
A Short Tutorial
The API for SearchBuilder was originally designed to be as close as possible to FormBuilder, so as to limit any learning curves.
$do =& DB_DataObject::factory('some_table_to_search');
// create the object using new instead of a create function
$builder =& new DB_DataObject_SearchBuilder($do);
// turn on paged searching if required
$builder->doPaging = true;
// use the searchFields array to specify the search parameters (analogous to fieldsToRender)
$builder->searchFields = array('first_name','surname','dob');
// call getForm just as with FormBuilder
$form =& $builder->getForm();
// display the search form
// validate and process the same as with FormBuilder
// print the results using the default html
Should result in some html like:
|Found 167 results, displaying 1 to 10
||Date Of Birth