Gossamer Forum
Home : Products : DBMan : Customization :

Need help desperate.

Quote Reply
Need help desperate.
I can't think clear no more.

This is a piece of the HTML view_succes sub:

# Go through each hit and convert the array to hash and send to
# html_record_short for printing.
for (0 .. $numhits - 1) {

&html_record_short (&array_to_hash($_, @hits));
}

I want to let the script check if there is only 1 hit first. If so the use &html_record otherwise &html_record_short But how i I do that???

Some help is appreciated, as always.

Jeroen
Quote Reply
Re: Need help desperate. In reply to
Where you put the code depends on what your html_record subroutine looks like. For example, I have html_record as a complete page, including
&html_print_headers
print qq|<html><head>...

Because I wanted one of the fields to show up in my title bar --

<title>$rec{'Title'}</title>

I have it set up like this, in html_view success:

Code:
my ($maxhits); $in{'mh'} ? ($maxhits = $in{'mh'}) : ($maxhits = $db_max_hits);

if ( $db_total_hits == 1 ) {
&html_record(&array_to_hash($_, @hits));
}
else {
&html_print_headers;
print qq|
<html>
<head>
<title>$html_title: Search Results.</title>
</head>
[etc, ending with]
<tr><td>|;
&html_footer;
print qq|</td></tr>
</table>
</blockquote>
</body>
</html>
|;
}
}

If you didn't want the title to be in the title bar, you could move it down a bit, probably before

<p><$font>Your search returned <b>$db_total_hits</b> matches.</font>

Hope this helps!

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


Quote Reply
Re: Need help desperate. In reply to
Thanx for the reply jp.

It did not helped me on what i needed but helped me on something else.

I was behind my computer too long an doing something totally different for a while made me see the solution myself.

Jeroen