Gossamer Forum
Home : Products : Gossamer Links : Discussions :

how do i add search option

Quote Reply
how do i add search option
Hi,

I am trying to insert a search bar into my installation but for some reason the options to search this category or search all categories does not display on the screen. It is definitely there but just doesn't display.

Can anyone give me a pointer please, I am wondering if the if statements above it are totalising it.

Here is my code, its pretty standard stuff...

<form action="<%db_cgi_url%>/search.cgi" method="GET">
<tr><td>
<table cellpadding=6 cellspacing=0 border=0 style="border-collapse: collapse" bordercolor="#111111">
<tr><td><%body_font%><p align="right">
<font size="1" face="Verdana" color="#000080">Search Again &gt;</font></font>
<input type="text" size=26 name="query" value="where are my search options">
<%if category_id%>
<%body_font%><small>
<input type="radio" name="catid" value=""> All regions<input type="radio" name="catid" value="<%category_id%>" checked> only <%name%></small></font>
<%endif%></p>
<p align="right">
<input type=submit value="Products" style="font-size: 8pt; font-family: Verdana">

It is there but simply doesn't display and I am not quite sure what I have done here.
many thanks

Kev

Cheers
KevM
Quote Reply
Re: [KevM] how do i add search option In reply to
It will only display on the category page (unless you set the category_id tag on another page).
Quote Reply
Re: [afinlr] how do i add search option In reply to
Hi,

I have re read the manual and searched all posts going back a year but I can't seem to make any progress on this, can anyone point me another pointer
Quote:
It will only display on the category page (unless you set the category_id tag on another page).
I've found a plugin that apparently gets the category id for page output but it doesn't seem to have done much for me. I have also looked at the Links SQl demo and that has the same problem, you don't get the option to search again within the category or wherever you are, it seems to default to a global search which not what I want. Rgds Kevin

Cheers
KevM
Quote Reply
Re: [KevM] how do i add search option In reply to
Please can you have another go at explaining exactly what you want to do? Sorry if it seems obvious to you but I can't quite understand yet.

If you look at the demo, click on any of the categories and you will get a search bar which has a 'search only this category' option. So what is it that you want beyond this?
Quote Reply
Re: [afinlr] how do i add search option In reply to
Hi afinlr

what I want to do is to enable (after the first category search has been done) another search within the same category, not the entire site.

As an example from the links demo

I drill down to Home>Television>News>Programs

So I am now in Programs category. Imagine there are lots and lots of links (I appreciate the demo only has a certain amount.)

If I try a search for 48 Hours in this category and tell it only this category via the radio buttons (which my set up is set to do) I get one result/link.

So far its ok. As a user I would expect to be able to search again in this category by default or move up the tree if I wanted to.

I can't as I don't have the choice although I would expect to still be in the Programs category, I have to drill down to it again or my next search returns the entire database of results.

E.G my next search for another TV program - 60 minutes (or even 48 Hours again) defaults to searching the entire database. Even though there is only one link in TV programs it returns 5 categories and 40 links.

This could easily be 70 categories and hundreds of links. I want to change this defualt i.e unless you tell it to search elsewhere then it will keep searching your category that you drilled down to, to search in, in the first place.

Another example is the search term 'program'; search in Home>Television>News>Programs for program and then search program again.

You might expect the same results but you don't, in TV programs there are 13 links, in the whole databse there are 483, try to then search again to refine it with say 48 Hours again and you get the 483 links of which 482 are irrelevant and not from where you started.

I've probably over explained this but I hope it makes sense.

Many thanks,

rgds
Kevin

links demo here>
http://www.gossamer-threads.com/.../Programs/index.html

Cheers
KevM
Quote Reply
Re: [KevM] how do i add search option In reply to
OK - thanks for the explanation it is much clearer now.

To get the option to search the current category just change <%if category_id%> to <%if category_id or catid%> in the search bar.

You'll also need to change

value="<%category_id%>"

to

value="<%if category_id%><%category_id%><%elsif catid%><%catid%><%endif%>"
Quote Reply
Re: [afinlr] how do i add search option In reply to
Hi Afinlr,

Brilliant, thank you very much.

Smile

Cheers
KevM