Gossamer Forum
Home : Products : Gossamer Links : Discussions :

A search box (dropdown) for categories

Quote Reply
A search box (dropdown) for categories
Hello,

For links sql, is it possible to have a search box (dropdown) for categories exactly the way it works for GForum?

If yes, how to have do so?

Many thanks

Antoine

Quote Reply
Re: [antoined] A search box (dropdown) for categories In reply to
You could try something like;

<%global_name%>

Code:
sub {
my $tags = shift;
my $table = $DB->table('Category');

$table->select_options ("ORDER BY Full_Name") || return $GT::SQL::error;
my $sth = $table->select ( ['Full_Name','ID'] ) || return $GT::SQL::error;
my $output = '<select name="CatID">';

while (my $row = $sth->fetchrow_hashref) {
$output .= '<option value='.$row->{ID}.'>'.$row->{Title}.'</option>';
}

$output .= '</select>';
return $output;
}

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy: Nov 29, 2003, 9:51 AM
Quote Reply
Re: [Andy] A search box (dropdown) for categories In reply to
I called it <%global_search%> and I had the following error:

A fatal error has occured:
Can't call method "fetchrow_hashref" on an undefined value at (eval 5) line 8. So?Antoine

Quote Reply
Re: [antoined] A search box (dropdown) for categories In reply to
Sorry, it should be;

$table->select_options ("ORDER BY Full_Name");

not

$table->select_options ("ORDER BY Ful_Name");

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] A search box (dropdown) for categories In reply to
And ID not iD? Angelic
Quote Reply
Re: [Andy] A search box (dropdown) for categories In reply to
Hi Andy,

there is no Fatal error now.... but nothing is displayed in the footer area where I put the

tag <%global_search%>

Let me know

Thanks againWink

Antoine
Quote Reply
Re: [antoined] A search box (dropdown) for categories In reply to
Hi. Sorry about that. Couple of other boo boos in there. The current version should work ok :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] A search box (dropdown) for categories In reply to
Unfortunatly still not working!!! nothing is displaying.
Quote Reply
Re: [antoined] A search box (dropdown) for categories In reply to
What does the modified version do for you now? Its obviously failing on the query, so lets see why :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] A search box (dropdown) for categories In reply to
the output of the modified version is blanck , no error or similar.
Quote Reply
Re: [antoined] A search box (dropdown) for categories In reply to
And now?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] A search box (dropdown) for categories In reply to
nothing happens... the same thing.
Quote Reply
Re: [Andy] A search box (dropdown) for categories In reply to
Andy, think it needs to be more like this:sub {
my $tags = shift;
my $table = $DB->table('Category');

$table->select_options ("ORDER BY Full_Name") || return $GT::SQL::error;
my $sth = $table->select ( ['Full_Name','ID'] ) || return $GT::SQL::error;
my $output = '<select name="CatID">';

while (my ($fullname,$ID) = $sth->fetchrow_array) {
$output .= '<option value='.$ID.'>'.$fullname.'</option>';
}

$output .= '</select>';
return $output;
}
Quote Reply
Re: [afinlr] A search box (dropdown) for categories In reply to
yes it works now with the second solution of afinlr : i got the dropdown box full of all categories!! Sly

.... and now how to click "go" to go to the chosen categerory?Blush

(((it could be better on directory select, it will jump to the related category))).

Thanks
Antoine

Last edited by:

antoined: Nov 30, 2003, 3:48 AM
Quote Reply
Re: [antoined] A search box (dropdown) for categories In reply to
Hi,

I just wanted to point to this "useful thread":

http://www.gossamer-threads.com/...orum.cgi?post=204675

Regarding to your question I suggest:

Code:
<form action=<%db_cgi_url%>/page.cgi method=GET>

<select name=g><%your_global%></select>...

maybe there is an easier way...

RegardsNiko