Gossamer Forum
Home : Products : Links 2.0 : Customization :

Category Search

Quote Reply
Category Search
Hello!

How I can do category search, which let to search from different categories like in a http://www.hotscripts.com/C_and_C++/ ??

Thanx!

Quote Reply
Re: Category Search In reply to
Yeah Widgetz did it but it's no longer available.

Good Luck!


Glenn
Quote Reply
Re: Category Search In reply to
Hi!

Do you mean you want to search entries in a certain category only? Then you could do this:

1) In search.cgi go to sub search.
Find # Go through the database..
After the 8th line (which should be $grand_total++;) add this:

if ($in{'category'} && $in{'category'} ne "all") {
($values[$db_category] =~ m/^$in{'category'}/) or next LINE;
}

2) Open nph_build.cgi. In sub build_category_pages find $total = ($#{$links{$cat}} + 1) / ($#db_cols + 1);
Right after it place this line:

$title_url = $cat;

(Hm, a note: as I see it now it's actually the same as $category_name = $cat; - could have taken that one, but for some reason that didn't worked for me - anyway, the way I put it here it does...)

3) In site_html_templates.pl find sub site_html_category and add after build_links_per_page => $build_links_per_page,/ this:

title_url => $title_url,

(I'm using non-templates, so I hope this step is correct...)

4) Open category.html. Find <input type="text" size=30 name="query"> and add the following line right before that tag:

(search this category only <input type="checkbox" name="category" value="$title_url" CHECKED>)

Don't forget: before saving your files backup your originals!!

This should be already doing it. When the checkbox is marked people should be able to search for links in the current directory only. Note: the search doesn't effect a category's subcats, of course. Unchecking the box will do the search in all cats.
If for some reason you run into problems with searching in all categories try adding <input type="hidden" name="category" value="all"> to the respective HTML-formular... but I think you shouldn't.

Denis