Hello
i've added a field in links.def for language, and donw for drop box.
i've used upgrade.pb because i've got some links in my links.db ;o)
After i've added some codes in links.html for pics of languages.
It works.
I wanted to propose search by languages,
so i've added some codes in search.cgi, search.html.
It's allright for german, english... language, but not with the option "all". I've got : "No match found".
I think that i've made a mistake, and "all" is understand like the language "all", like "german, french..."
But when i didn't put "all" in %db_select_fields in links.def, it's not allright for "all" but for "german", "enghlish..." yes!
This are the codes i've added, thanks for your help...
* In links.def :
Rating => [11, 'numer', 10, 10, 1, 0, '^[\d\.]+$'],
Votes => [12, 'numer', 10, 10, 1, 0, '^\d+$'],
ReceiveMail => [13, 'alpha', 10, 10, 1, 'Yes', 'No|Yes'],
Pic => [14, 'alpha', 40, 100, 0, '', ''],
langue => [15, 'alpha', 40, 100, 0, '', ''] );
* In links.def :
# Field Number of some important fields. The number is from %db_def above
# where the first field equals 0.
$db_category = 4; $db_modified = 3; $db_url = 2;
$db_hits = 8; $db_isnew = 9; $db_ispop = 10;
$db_contact_name = 6; $db_contact_email = 7; $db_title = 1;
$db_votes = 12; $db_rating = 11; $db_mail = 13;
$db_langue = 15;
* In links.def:
# Field names you want to allow visitors to search on:
@search_fields = (1,2,5,15);
* In links.def :
# Hash of column names to possible options. If you want to use a select form
# field, you can use &build_select_field in your HTML page. This routine will
# make a <SELECT> input tag using the following values:
%db_select_fields = (
isNew => 'Yes,No',
isPopular => 'Yes,No',
langue => 'All,Allemand,Anglais,Espagnol,Français,Italien',
ReceiveMail => 'Yes,No'
);
* In search.cgi :
# 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++;
if ($in{'langue'} && $in{'langue'} ne "All") {
($values[$db_langue] =~ /^$in{'langue'}/) or next LINE;
}
* In search.html with templates :
<form action="<%db_cgi_url%>/search.cgi" method="GET">
<div class="margin">
<table border="0" cellpadding="0" cellspacing="0">
<tr><td>Search: <input type="TEXT" name="query" size="30"> <input type="Submit" value="Search"></td></tr>
<tr><td>Number of Results: <SELECT name="mh"><OPTION>10<OPTION SELECTED>25<OPTION>50<OPTION>100</SELECT></td></tr>
<tr><td>Langue: <select name="langue">
<option value="All">All</option>
<option value="Allemand">Allemand</option>
<option value="Anglais">Anglais</option>
<option value="Espagnol">Espagnol</option>
<option value="Français">Français</option>
<option value="Italien">Italien</option>
</select></td></tr>
<tr><td>As Keywords: <input type="RADIO" name="type" value="keyword" CHECKED> As Phrase: <input type="RADIO" name="type" value="phrase"></td></tr>
<tr><td>AND connector: <input type="RADIO" name="bool" value="and" CHECKED> OR connector: <input type="RADIO" name="bool" value="or"></td></tr>
</table>
</div>
</form>
THANKs for your help.
Ciao
PS: i've searched in the forum, but i didn't find any answer, there will be a lot of posts,
i've put : search all search.cgi with AND option, but there will be so many posts.
i've added a field in links.def for language, and donw for drop box.
i've used upgrade.pb because i've got some links in my links.db ;o)
After i've added some codes in links.html for pics of languages.
It works.
I wanted to propose search by languages,
so i've added some codes in search.cgi, search.html.
It's allright for german, english... language, but not with the option "all". I've got : "No match found".
I think that i've made a mistake, and "all" is understand like the language "all", like "german, french..."
But when i didn't put "all" in %db_select_fields in links.def, it's not allright for "all" but for "german", "enghlish..." yes!
This are the codes i've added, thanks for your help...
* In links.def :
Rating => [11, 'numer', 10, 10, 1, 0, '^[\d\.]+$'],
Votes => [12, 'numer', 10, 10, 1, 0, '^\d+$'],
ReceiveMail => [13, 'alpha', 10, 10, 1, 'Yes', 'No|Yes'],
Pic => [14, 'alpha', 40, 100, 0, '', ''],
langue => [15, 'alpha', 40, 100, 0, '', ''] );
* In links.def :
# Field Number of some important fields. The number is from %db_def above
# where the first field equals 0.
$db_category = 4; $db_modified = 3; $db_url = 2;
$db_hits = 8; $db_isnew = 9; $db_ispop = 10;
$db_contact_name = 6; $db_contact_email = 7; $db_title = 1;
$db_votes = 12; $db_rating = 11; $db_mail = 13;
$db_langue = 15;
* In links.def:
# Field names you want to allow visitors to search on:
@search_fields = (1,2,5,15);
* In links.def :
# Hash of column names to possible options. If you want to use a select form
# field, you can use &build_select_field in your HTML page. This routine will
# make a <SELECT> input tag using the following values:
%db_select_fields = (
isNew => 'Yes,No',
isPopular => 'Yes,No',
langue => 'All,Allemand,Anglais,Espagnol,Français,Italien',
ReceiveMail => 'Yes,No'
);
* In search.cgi :
# 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++;
if ($in{'langue'} && $in{'langue'} ne "All") {
($values[$db_langue] =~ /^$in{'langue'}/) or next LINE;
}
* In search.html with templates :
<form action="<%db_cgi_url%>/search.cgi" method="GET">
<div class="margin">
<table border="0" cellpadding="0" cellspacing="0">
<tr><td>Search: <input type="TEXT" name="query" size="30"> <input type="Submit" value="Search"></td></tr>
<tr><td>Number of Results: <SELECT name="mh"><OPTION>10<OPTION SELECTED>25<OPTION>50<OPTION>100</SELECT></td></tr>
<tr><td>Langue: <select name="langue">
<option value="All">All</option>
<option value="Allemand">Allemand</option>
<option value="Anglais">Anglais</option>
<option value="Espagnol">Espagnol</option>
<option value="Français">Français</option>
<option value="Italien">Italien</option>
</select></td></tr>
<tr><td>As Keywords: <input type="RADIO" name="type" value="keyword" CHECKED> As Phrase: <input type="RADIO" name="type" value="phrase"></td></tr>
<tr><td>AND connector: <input type="RADIO" name="bool" value="and" CHECKED> OR connector: <input type="RADIO" name="bool" value="or"></td></tr>
</table>
</div>
</form>
THANKs for your help.
Ciao
PS: i've searched in the forum, but i didn't find any answer, there will be a lot of posts,
i've put : search all search.cgi with AND option, but there will be so many posts.