Hi Eliot, maybe it's ask before but I couldn't find it. I've copied this script from the forum:
All you need to do is in search.cgi find the following:
--------------------------------------------------------------------
# If we have a hit, add it in!
if (($or_match && $match) or $andmatch) {
push (@{$link_results{$values[$db_category]}}, @values);
$numhits++; # We have a match!
}
--------------------------------------------------------------------
and replace it with this:
##########################################################################################
# <-------- Start subcategories search - Jose Reffoios - jreffoios@hotmail.com --------> #
##########################################################################################
# Split Categories and sub Categories into two different variables
($subcat1,$subcat2) = split(/\//, $values[$db_category]);
# do the same for the form's hidden value (category or subcateg name)
($subcat3,$subcat4) = split(/\//, $in{'thiscat'});
# check what type of category is and define what the search criteria will be
if ($subcat4) {$subcat1 = $values[$db_category];}
if ($in{'thiscat'})
{
if ($subcat1 eq $in{'thiscat'})
{
# If we have a hit, add it in!
if (($or_match && $match) or $andmatch) {
push (@{$link_results{$values[$db_category]}}, @values);
$numhits++; # We have a match!
}
}
}
else
{
# If we have a hit, add it in!
if (($or_match && $match) or $andmatch) {
push (@{$link_results{$values[$db_category]}}, @values);
$numhits++; # We have a match!
}
}
##########################################################################################
# <--------- End subcategories search - Jose Reffoios - jreffoios@hotmail.com ---------> #
##########################################################################################
Now you just need to add, where ever you use the search
form the following (should be the "category.html" template):
--------------------------------------------------------------------
<input type="checkbox" name="thiscat" value="<Êtegory_name%>">
<font face="verdana" size="2">Search this Category</font>
--------------------------------------------------------------------
but it's not working correctly. I will explain the error in an example.
I've 3 categories: shareware - freeware - cardware
The link I'm searching for is in the category "cardware".
So when I search "only" in the category shareware (the script can't find the link = good)
When I search "only" in the category cardware (the script found the link = also good)
but when I search in both categories "shareware" AND "cardware" (the script says = link not found = is NOT good, because...)
I've tried to modify it but I can't get it to work. Can you help me with this one....
All you need to do is in search.cgi find the following:
--------------------------------------------------------------------
# If we have a hit, add it in!
if (($or_match && $match) or $andmatch) {
push (@{$link_results{$values[$db_category]}}, @values);
$numhits++; # We have a match!
}
--------------------------------------------------------------------
and replace it with this:
##########################################################################################
# <-------- Start subcategories search - Jose Reffoios - jreffoios@hotmail.com --------> #
##########################################################################################
# Split Categories and sub Categories into two different variables
($subcat1,$subcat2) = split(/\//, $values[$db_category]);
# do the same for the form's hidden value (category or subcateg name)
($subcat3,$subcat4) = split(/\//, $in{'thiscat'});
# check what type of category is and define what the search criteria will be
if ($subcat4) {$subcat1 = $values[$db_category];}
if ($in{'thiscat'})
{
if ($subcat1 eq $in{'thiscat'})
{
# If we have a hit, add it in!
if (($or_match && $match) or $andmatch) {
push (@{$link_results{$values[$db_category]}}, @values);
$numhits++; # We have a match!
}
}
}
else
{
# If we have a hit, add it in!
if (($or_match && $match) or $andmatch) {
push (@{$link_results{$values[$db_category]}}, @values);
$numhits++; # We have a match!
}
}
##########################################################################################
# <--------- End subcategories search - Jose Reffoios - jreffoios@hotmail.com ---------> #
##########################################################################################
Now you just need to add, where ever you use the search
form the following (should be the "category.html" template):
--------------------------------------------------------------------
<input type="checkbox" name="thiscat" value="<Êtegory_name%>">
<font face="verdana" size="2">Search this Category</font>
--------------------------------------------------------------------
but it's not working correctly. I will explain the error in an example.
I've 3 categories: shareware - freeware - cardware
The link I'm searching for is in the category "cardware".
So when I search "only" in the category shareware (the script can't find the link = good)
When I search "only" in the category cardware (the script found the link = also good)
but when I search in both categories "shareware" AND "cardware" (the script says = link not found = is NOT good, because...)
I've tried to modify it but I can't get it to work. Can you help me with this one....