Gossamer Forum
Home : Products : Gossamer Links : Discussions :

search rules

Quote Reply
search rules
I noticed that the search bar <%include include_search_bar.html%> search for words only in TITLE and DESCRITION.
What if, i would like to let search in a new field created by me i.e: <%country%>

Thanks
Antoine
Quote Reply
Re: [antoined] search rules In reply to
Sure... just add a 'text' field, called 'country', and submit it to search.cgi, and it should work :)

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] search rules In reply to
   
Thanks Andy for that,

Is there a global to let users search by country? where <%country%> is alreay a field created by me.

Many Thanksssss
Antoine
Quote Reply
Re: [antoined] search rules In reply to
Try with ../search.cgi?country=xxxx
Quote Reply
Re: [antoined] search rules In reply to
You just need to copy the dropdown box for country, that you see on the add/modify form pages in the admin panel. That should give you the full list of countries that you have listed on your site.

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] search rules In reply to
I don't have a dropdown box in the admin, it is a simple text field <%country%> , my question is how to get a drop menu select with the countries already added by users in order to have it works like
i.e. .../search.cgi?d=1&query=usa, where usa is generated by <%country%>

Thanks
Antoine
Quote Reply
Re: [antoined] search rules In reply to
Try this global. It will generate a unique list of countries in your database, in the form of a dropdown box. Please note, its not going to be lightning fast, so I wouldn't recommend using it on dynamic pages,....

Code:
sub {

my $table = $DB->table('Links');
$table->select_options('ORDER BY countries');
my $sth = $table->select( 'DISTINCT(countries)' ) || return "$GT::SQL::error";

my $back;
$back .= '<option value="">------</option>';
while (my $hit = $sth->fetchrow_hashref) {
next if !$hit->{countries};
$back .= qq|<option>$hit->{countries}</option>|;
}

return $back;

}

Just call it with <%global_name%>

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] search rules In reply to
Could you help me further to integrate it with the dropdown box, that i don't know how to make it.

Many Thanks Again

Antoine