Does anyone have a way to display search results in 2 columns? For example if there ar 10 records, display 5 in each column... if there are 14 records it would have 7 in each column. Thanks for any help on this.
Apr 19, 2000, 6:08 AM
User (223 posts)
Apr 19, 2000, 6:08 AM
Post #2 of 3
Views: 1287
dotcom,
This sounds like a table issue mostly. You'd have to use a switching variable to track if you're in the first table or the second.
For example, in sub html_record (html.pl):
if($table eq 1) {
print qq| <TR><TD> html to display record </TD> |;
$table = 2;
} elsif($table eq 2) {
print qq| <TD> html to display record </TD></TR> |;
$table = 1;
} else { &cgierror("Error processing request.\nInvalid integer request in html_record."); } # If we lose our integer, send an error message[/code]
Then in your sub html_view_success (html.pl), add the following line:
right after:
To properly close the table, add:
print qq| <TD> & nbsp ; </TD></TR> |; # the nbsp will make the table look right
(You'll want to take the space out before and after the nbsp)
right after:
# html_record for printing.
for (0 .. $numhits - 1) {
print "<P>";
&html_record (&array_to_hash($_, @hits));
}
and before:
print "<br><$font>Pages: $db_next_hits</font>";
}
To make this code work, make sure you are using tables. You may need to taylor this code to your specific needs, but the theory is sound.
--Lee
[This message has been edited by leisurelee (edited April 19, 2000).]
[This message has been edited by leisurelee (edited April 19, 2000).]
This sounds like a table issue mostly. You'd have to use a switching variable to track if you're in the first table or the second.
For example, in sub html_record (html.pl):
if($table eq 1) {
print qq| <TR><TD> html to display record </TD> |;
$table = 2;
} elsif($table eq 2) {
print qq| <TD> html to display record </TD></TR> |;
$table = 1;
} else { &cgierror("Error processing request.\nInvalid integer request in html_record."); } # If we lose our integer, send an error message[/code]
Then in your sub html_view_success (html.pl), add the following line:
Code:
$table = 1;right after:
Code:
&html_print_headers;To properly close the table, add:
Code:
if ($table eq 2) { print qq| <TD> & nbsp ; </TD></TR> |; # the nbsp will make the table look right
(You'll want to take the space out before and after the nbsp)
right after:
Code:
# Go through each hit and convert the array to hash and send to # html_record for printing.
for (0 .. $numhits - 1) {
print "<P>";
&html_record (&array_to_hash($_, @hits));
}
and before:
Code:
if ($db_next_hits) { print "<br><$font>Pages: $db_next_hits</font>";
}
To make this code work, make sure you are using tables. You may need to taylor this code to your specific needs, but the theory is sound.
--Lee
[This message has been edited by leisurelee (edited April 19, 2000).]
[This message has been edited by leisurelee (edited April 19, 2000).]