Gossamer Forum
Home : Products : DBMan : Customization :

Adding a sub-routine...

Quote Reply
Adding a sub-routine...
Hi,

JPDeni (Thank you!!!!) gave me some code that has to be added as a sub-routine into html.pl.

I have to add:
$in{'mh'} = 1;
$in{'sb'} = 3;

$in{'Date-lt'} = &get_date;
$in{'so'} = 'descend';
my ($status,@before) = &query('view');
push(@hits,@before);

$in{'Date-lt'} = '';
$in{'Date-gt'} = &get_date;
$in{'so'} = 'ascend';
my ($status2,@after) = &query('view');
push(@hits,@after);

my ($numhits) = 2;

into a new subroutine with the rest of the SR the same content as html_view_success.

Is this the correct code for the new sub-routine:

#############################
##Last Match and Next Match##
#############################
sub html_view_header {
# --------------------------------------------------------
# This sub displays the last record and next record
# in the database related to the date:
#
# $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.
#

$in{'mh'} = 1;
$in{'sb'} = 3;

$in{'Date-lt'} = &get_date;
$in{'so'} = 'descend';
my ($status,@before) = &query('view');
push(@hits,@before);

$in{'Date-lt'} = '';
$in{'Date-gt'} = &get_date;
$in{'so'} = 'ascend';
my ($status2,@after) = &query('view');
push(@hits,@after);

my ($numhits) = 2;

&html_print_headers;
print qq|
<html>
<head>
<title>Manchester City International Supporters - $html_title</title>
</head>

|;
if ($in{'format'} eq "long") {
&html_record (&array_to_hash($_, @hits));
}
else {


print qq|
<body bgcolor="#ffffff">
<$font>

|;


# Go through each hit and convert the array to hash and send to
# html_record for printing.
for (0 .. $numhits - 1) {
print "";
&html_record_short (&array_to_hash($_, @hits));
}


print qq|
</body>
</html>

|;
}
}


Any help would be REALLY appreciated.

Ta.

Scall