Gossamer Forum
Home : Products : DBMan : Customization :

what am i doing wrong here?

(Page 2 of 2)
> >
Quote Reply
Re: what am i doing wrong here? In reply to
Ok ... you gotta trouble shoot this by printing out your variables and seeing how numbers or links are being passed. I put the ++$rec_count there because ... the of the brackets and ... I could be wrong but in transistor's case it worked.

Are you using the same mods that he is ??? short/long + pic upload + column view (not row view) ???

post that section (only) if you're still having toubles.


good luck

**************************************
on the pages in between ...
Quote Reply
Re: [pdressler] what am i doing wrong here? In reply to
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>&nbsp;</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
Quote Reply
Re: [Oink] what am i doing wrong here? In reply to
This is an old discussion, but here is how to fix the short display linking to the previous record:

In sub html_view_success, you need to make a couple of changes:

- - - - - - -

if ($db_next_hits) { print "<br><$font>Pages: $db_next_hits</font>"; }
$cols = 2; # Change this to the number of columns you want
$rec_count = 1; #<<< Add This Line
print "<table>";
for (0 .. $numhits - 1) {
unless ($_%$cols) {
print "<tr>";
}
&html_record (&array_to_hash($_, @hits));
if ($_%$cols==($cols-1)) {
print "</tr>\n";
}
++$rec_count #<<<Make Sure This Line Exists
}
if ($numhits%$cols) {
for ($j=($cols-1);$j>=$numhits%$cols ;$j--) {
print "<td>&nbsp;</td>";
}
print "</tr>\n";
}
print "</table>";
if ($db_next_hits) { print "<br><$font>Pages: $db_next_hits</font>";}
> >