 |
 |
 |
 |
 |
| Author |
Message |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2736 Location: Germany |
|
How to limit the search to certain categories |
|
With this little hack you can define which categories you want to search in.
It seems this hack only works using MySQL.
Open search.php and find this:
 |  | $where[] = 'and'; |
add below:
 |  | $allowed_categories = array("1", "2", "3"); //Enter the categories you want to search in
foreach($allowed_categories as $single){
$where[] = 'category =~ %'.$single.'%';
$where[] = 'or';
}
$count = count($where)-1;
unset ($where[$count]);
foreach ($allowed_categories as $k => $v){
for ($i = 0; $i < 10; $i++){
if (!in_array($v.$i, $allowed_categories)){
$where[] = 'and';
$where[] = 'category !~ %'.$v.$i.'%';
}
if (!in_array($i.$v, $allowed_categories)){
$where[] = 'and';
$where[] = 'category !~ %'.$i.$v.'%';
}
}
}
$where[] = 'and'; |
Change the first line of this code by adding the IDs of your categories.
|
|
| Wed Jul 19, 2006 6:41 pm |
|
 |
Guest
|
|
|
Please login to hide the ads.
|
|
|
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
 |
 |
 |
|