On some searches at my site there are sometimes no matching categories so all that shows up is
Categories:
Can someone please tell me how I can alter the code so that if there are no category hits, a html message is displayed such as...
Sorry No Matching Category Hits
The section of code in search.cgi I thought needs to be changed is this:
# Build the HTML for the category results and store it in "$category_results". Only build the html
# if we are on the first set of link results.
foreach $category (@category_results) { $cat_hits++; }
$half = $cat_hits / 2;
if ($nh == 1) {
$category_results = qq|<table bgcolor="#ffffff" align="left" border="0" cellpadding="0" cellspacing="0" width="100%">\n<tr>\n<td width="50%">\n|;
foreach $category (@category_results) {
if ($cat_count == $half) {
$category_results .= qq|</td>\n<td width="50%">|;
}
$cat_clean = &build_clean($category);
$linked_title = &build_linked_title ($category);
$category_results .= qq|<li>$linked_title\n|;
$cat_count++;
}
$category_results .= qq|</td>\n</tr>\n</table>|;
}
$cat_hits ||= 0;
$lowrange = ($nh-1) * $maxhits + 1;
$highrange = $nh * $maxhits;
From Paul Wilson.
http://www.audio-grabber.com
Music Directory
Categories:
Can someone please tell me how I can alter the code so that if there are no category hits, a html message is displayed such as...
Sorry No Matching Category Hits
The section of code in search.cgi I thought needs to be changed is this:
# Build the HTML for the category results and store it in "$category_results". Only build the html
# if we are on the first set of link results.
foreach $category (@category_results) { $cat_hits++; }
$half = $cat_hits / 2;
if ($nh == 1) {
$category_results = qq|<table bgcolor="#ffffff" align="left" border="0" cellpadding="0" cellspacing="0" width="100%">\n<tr>\n<td width="50%">\n|;
foreach $category (@category_results) {
if ($cat_count == $half) {
$category_results .= qq|</td>\n<td width="50%">|;
}
$cat_clean = &build_clean($category);
$linked_title = &build_linked_title ($category);
$category_results .= qq|<li>$linked_title\n|;
$cat_count++;
}
$category_results .= qq|</td>\n</tr>\n</table>|;
}
$cat_hits ||= 0;
$lowrange = ($nh-1) * $maxhits + 1;
$highrange = $nh * $maxhits;
From Paul Wilson.
http://www.audio-grabber.com
Music Directory