Gossamer Forum
Home : Products : DBMan : Customization :

Problem with view_success - help!

Quote Reply
Problem with view_success - help!
The following is the code cut right from my html.pl file. Works fine in ie4 but not in netscape. If I view source the HTML is there but obviously I am missing something. Can anyone see the problem?

sub html_view_success {
# --------------------------------------------------------
# This page displays the results of a successful search.
# You can use the following variables when displaying your
# results:
#
# $numhits - the number of hits in this batch of results.
# $maxhits - the max number of hits displayed.
# $db_total_hits - the total number of hits.
# $db_next_hits - html for displaying the next set of results.
#

my (@hits) = @_;
my ($numhits) = ($#hits+1) / ($#db_cols+1);
my ($maxhits); $in{'mh'} ? ($maxhits = $in{'mh'}) : ($maxhits = $db_max_hits);

&html_print_headers;
print qq|
<html>
<head>
<title>$html_title: Search Results.</title>
</head>

<body bgcolor="#DDDDDD">
<blockquote><center>
<table border=1 bgcolor="#FFFFFF" cellpadding=5 cellspacing=3 width=500 valign=top>
<tr><td colspan=2 bgcolor="navy"><FONT FACE="MS Sans Serif, arial,helvetica" size=1 COLOR="#FFFFFF">
<b>$html_title: Search Results</b>
</font></td></tr>
<tr><td>
<p><$font>
Your search returned <b>$db_total_hits</b> matches.</font>
|;
if ($db_next_hits) {
print "<br><$font>Pages: $db_next_hits</font></td></tr></table>";
}

# Go through each hit and convert the array to hash and send to
# html_record for printing.
for (0 .. $numhits - 1) {
print "<center>";
&html_record (&array_to_hash($_, @hits));
print "</center>";
}
if ($db_next_hits) {
print qq~ <TABLE BORDER=1 BGCOLOR="#DDDDDD" CELLSPACING=0 CELLPADDING=3 WIDTH=500>
<TR>
<TD WIDTH=500 BGCOLOR="#FFFFcc">
<CENTER><A HREF="http"><FONT COLOR="#000000"></A>Pages: $db_next_hits</FONT></CENTER>
</TD>
</TR>
</TABLE>~;
}

print qq|

<table border=1 bgcolor="#ffffff" cellpadding=5 cellspacing=3 width=500 valign=top>
<tr><td>|; &html_footer; print qq|</td></tr>
</table></center>
</blockquote>
</body>
</html>
|;
}

P.S. I am using each record as a meeting agenda for a specific date so I only am viewing 1 record at a time.
Quote Reply
Re: Problem with view_success - help! In reply to
You're missing a closing </table> tag.

start of table 1:
Code:
<table border=1 bgcolor="#FFFFFF" cellpadding=5 cellspacing=3 width=500 valign=top>
<tr><td colspan=2 bgcolor="navy">
<FONT FACE="MS Sans Serif, arial,helvetica" size=1 COLOR="#FFFFFF">

start of table 2:
Code:
<table border=1 bgcolor="#ffffff" cellpadding=5 cellspacing=3 width=500 valign=top>
<tr><td>|; &html_footer;

closing table tag:
Code:
print qq|</td></tr>
</table></center>

Since you are only displaying one record on a page, the closing table tag within
if ($db_next_hits) {
isn't executed.

So, what you need to do is end your subroutine with:

Code:
&html_footer;
print qq|</td></tr>
</table>
</td></tr></table></center>
</blockquote>
</body></html>
|;

Also, since you're only returning one record per page, you could eliminate all the statements that start with if ($db_next_hits) { and the table row that includes Your search returned <b>$db_total_hits</b> matches.</font>

One question-- how is your html_record set up? Does it start with a <table> tag or does it start with <TR><TD>? My guess is that it starts with a <table> tag, since you have <center> just before you call html_record. If I'm right, you need to start a new row in your page-wide table for the record table:

<TR><TD><center>

and, of course, end it

</center></TD></TR>


In other words, your html_view_success should be:
Code:
sub html_view_success {
my (@hits) = @_;
my ($numhits) = ($#hits+1) / ($#db_cols+1);
my ($maxhits); $in{'mh'} ? ($maxhits = $in{'mh'}) : ($maxhits = $db_max_hits);

&html_print_headers;
print qq|
<html><head>
<title>$html_title: Search Results.</title>
</head>

<body bgcolor="#DDDDDD">
<blockquote><center>
<table border=1 bgcolor="#FFFFFF" cellpadding=5 cellspacing=3 width=500 valign=top>
<tr><td colspan=2 bgcolor="navy">
<FONT FACE="MS Sans Serif, arial,helvetica" size=1 COLOR="#FFFFFF">
<b>$html_title: Search Results</b>
</font></td></tr>|;
# Go through each hit and convert the array to hash and send to
# html_record for printing.
for (0 .. $numhits - 1) {
print "<TR><TD><center>";
&html_record (&array_to_hash($_, @hits));
print "</center></TD></TR>";
}
print qq|
<table border=1 bgcolor="#ffffff" cellpadding=5 cellspacing=3 width=500 valign=top>
<tr><td>|;
&html_footer;
print qq|</td></tr>
</table>
</td></tr>
</table></center>
</blockquote>
</body>
</html>
|;
}



------------------
JPD


[This message has been edited by JPDeni (edited February 17, 1999).]
Quote Reply
Re: Problem with view_success - help! In reply to
Should have watched my own work a little more carefully. As usual I goofed. Didn't close some <table> and <td><tr> tags.