In Reply To:
tried adding the line. It did change the result. Now when I click on the link, I get the record that's before the one I want. Kind of strange. I noticed in your html that you have two ++$rec_count; references. I only had one. So I tried adding another one in different places, but still no luck. Maybe I'm putting them in the wrong position.
I know this is old, I just installed Jpdeni's column mod, on top of functioning short/long display, html friendly mods... I have managed to solve the "all long_urls pointing to the first record" problem, but I am now facing pdressler's "long_url points to a previous record" issue. Here are some of my subs in my html.pl
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);
$in{'nh'} ? ($nh = $in{'nh'}) : ($nh = 1);
if ($maxhits == 1) {
&html_record_long(&array_to_hash(0, @hits));
}
else {
#attempt multi columns
$rec_count;
$cols = 4; # Change this to the number of columns you want
print "<table border=1>\n";
for (0 .. $numhits - 1) {
unless ($_%$cols) {
print "\n<tr>";
}
print "\n<td valign=top>";
&html_record (&array_to_hash($_, @hits));
print "</td>";
if ($_%$cols==($cols-1)) {
print "\n</tr>\n";
}
++$rec_count;
}
if ($numhits%$cols) {
for ($j=($cols-1);$j>=$numhits%$cols ;$j--) {
print "<td> </td>";
}
print "\n</tr>\n";
}
print "</table>";
#end multi columns
if ($db_next_hits) { print "<br><$font>Pages: $db_next_hits</font>";}
}
}
-------------------------------
sub html_record {
my (%rec) = @_;
# create link to full display
$record_number = ((($nh - 1) * $db_max_hits) + $rec_count);
$long_url = $ENV{'QUERY_STRING'};
$long_url =~ s/\&nh=\d+//;
$long_url =~ s/\&mh=\d+//;
$long_url = "$db_script_url?$long_url&nh=$record_number&mh=1";
print qq|
<a href="$long_url"><img src="/id02/font/images/$rec{'Image'}" border=0 width=100 height=100></a>|;
}
Help anybody? Thanks in advance