Hello
I was looking for a mod to search subcategories and i found one in the resources section of this site. ( http://josereffoios.virtualave.net/links/search_subc.txt )
the code replaces
--------------------------------------------------
# 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!
}
---------------------------------------------------
in search.cgi with
####################################################
# 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!
}
}
############################################
The problem is this mod only searchs down 2 levels, how can i modify this mod to search all subcategories?
Thanks bye
I was looking for a mod to search subcategories and i found one in the resources section of this site. ( http://josereffoios.virtualave.net/links/search_subc.txt )
the code replaces
--------------------------------------------------
# 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!
}
---------------------------------------------------
in search.cgi with
####################################################
# 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!
}
}
############################################
The problem is this mod only searchs down 2 levels, how can i modify this mod to search all subcategories?
Thanks bye