Revision: 15051
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 22, 2009 13:09 by jzumbrun
Initial Code
/**
* SearchEntries
*
* Options: Values
* ---------------
* words
*
* @param array $options
* @return bool
*/
function SearchEntries($options = array())
{
$search_result = array();
$words = explode(" ", $options['words']);
foreach($words as $word){
if(isset($options['limit']) && isset($options['offset'])) $search_result = array_merge($search_result,$this->GetEntries(array('word' => $word, 'sortBy' => $options['sortBy'], 'sortDirection' => $options['sortDirection'], 'limit' => $options['limit'], 'offset' => $options['offset'])));
else $search_result = array_merge($search_result, $this->GetEntries(array('word' => $word)));
}
// unique multidimential array for entryid
$new = array();
$exclude = array("");
for ($i = 0; $i<=count($search_result)-1; $i++) {
if (!in_array(trim($search_result[$i]->entryId) ,$exclude)) {
$new[] = $search_result[$i];
// key and value goes into array for testing
$exclude[] = trim($search_result[$i]->entryId);
}
}
//print_r($new);
return $new;
}
Initial URL
Initial Description
Initial Title
Code Igniter Search for multiple words
Initial Tags
search, codeigniter
Initial Language
PHP