Gossamer Forum
Home : Products : Links 2.0 : Customization :

AltCategories search mod

Quote Reply
AltCategories search mod
I've been looking for a search mod that will return all matches in the database, including links under AltCategories. At the moment, the search comes back only with the link in the main category. My AltCats mod worked well, and it's all going fine, but I'd like to see all categories the returned link is classified under.

I found Jeffo's mod post, but I can't find where in search.cgi his mod goes.

Code:
#JefMod added search in category plus subs AND NOW ALT
if ($in{'category'} && $in{'category'} ne "All") {
($values[$db_category] =~ /^$in{'category'}/) || ($values[$db_alt] =~ /$in{'category'}/) or next LINE;
}
#JefMod end

The referenced post Steal refers to isn't much help either. There's no clear indication of where the mod goes.

I also found the original mod post, curtesy of Widgetz, but the downloadable text files are no longer available.

I've been going in circles around the same few interlinked topics, and a search doesn't come up with anything new. Maybe I'm missing something, but I was wondering if anybody has any clue on where I need to place this mod? Or if someone still has a copy of the original text file that Widgetz had that I could get off of them to work it out myself?

Any help is appreciated.
Quote Reply
Re: [kelly] AltCategories search mod In reply to
Looks like it should go in search.cgi, sub search, after this:


# Go through the database.
open (DB, "<$db_file_name") or &cgierr("error in search. unable to open database: $db_file_name. Reason: $!");
flock (DB, 1) if ($db_use_flock);
LINE: while (<DB>) {
/^#/ and next LINE; # Skip comment Lines.
/^\s*$/ and next LINE; # Skip blank lines.
chomp; # Remove trailing new line.
@values = &split_decode($_);
$grand_total++;

#JefMod added search in category plus subs AND NOW ALT
if ($in{'category'} && $in{'category'} ne "All") {
($values[$db_category] =~ /^$in{'category'}/) || ($values[$db_alt] =~ /$in{'category'}/) or next LINE;
}
#JefMod end


...as per this post...

http://www.gossamer-threads.com/...cgi?post=84232#84232


More info you may already have seen...

http://www.gossamer-threads.com/...cgi?post=27231#27231

http://www.gossamer-threads.com/...cgi?post=44444#44444

http://www.gossamer-threads.com/...cgi?post=92153#92153

http://www.gossamer-threads.com/...cgi?post=85197#85197


Of course, you also need to set up your search forms with the option to search some subcats, or all subcats.

http://www.gossamer-threads.com/...cgi?post=49220#49220

Dontcha love it when the code is all over the place?Mad

When you get this working how you want, I suggest you post your code here, all in one place.Angelic



Leonard
aka PerlFlunkie