SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 321 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"

'filter_catid',
'filter_catid');
$filter_search = $mainframe->getUserStateFromRequest(
>$option.'filter_search',
'filter_search');
// prepare the WHERE clause
$where = array();
// Determine published state
if ($filter_state == 'P')
{
Rendering Output
[ 240 ]
$where[] = 'published = 1';
}
else if ($filter_state == 'U')
{
$where[] = 'published = 0';
}
// Determine category ID
if ($filter_catid = (int)$filter_catid)
{
$where[] = 'catid = '.$filter_catid;
}
// Determine search terms
if ($filter_search = trim($filter_search))
{
$filter_search = JString::strtolower($filter_search);
$db =& $this->_db;
$filter_search = $db->getEscaped($filter_search);
$where[] = 'LOWER(name) LIKE "%'.$filter_search.'%"';
}
// return the WHERE clause
return (count($where)) ? ' WHERE '.implode(' AND ', $where) : '';
}
This example only searches the name field; it's likely that we would actually want
to search multiple fields. If this were the case we would need to modify the query
appropriately. For example:
$where[] = '(LOWER(name) LIKE "%'.


Pages:
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6