Gossamer Forum
Home : Products : Links 2.0 : Customization :

Problem with review mod.

Quote Reply
Problem with review mod.
I'm making one and I am trying to show an x number of reviews on the detailed pages for each link. I want to show the latest ones though. I can easily do it showing the first 2 but I used the Lastlink mod and I can't get it to work. I can see why but don't know how to fix it.

In sub detailed_view I have

$review = &opinions($rec{'ID'});
so that each time nph-build.cgi calls it for each Id it will call sub opinions, which looks like this


Code:
sub opinions {
my $id = shift;
my $x = 2;
my (@lines, $link, @tmp, %tmp);
open (D, "<$db_opinions_name") or &cgierr("unable to open database:$db_opinions_name.\nReason: $!");
@lines = <D>;
close D;
A: for ($i = $#lines; $i >= $#lines - $x + 1; $i--) {
chomp $lines[$i];
@tmp = &split_op_decode ($lines[$i]);
%tmp = &array_to_op_hash (0, @tmp);
$link .= &site_html_opinions_link (%tmp) if ($tmp[$db_op_pid] == $id);
}
return $link;
}
see so I have it set to show 2 reviews per ID. In my review db, I have the id to the link that the review is for stored as $db_op_pid. I check it against $id. That part works but when $x is set at 2 it will only print two for the first detailed page. When I set it to 4 (there are only three reviews for the first and second links), it prints 3 for the first and 1 for the second. So it's obviously not resetting or anything. Does anyone have a suggestion for better code? I was thinking of just starting the loop over.
Lavon Russell
LookHard Mods
lavon@lh.links247.net
Subject Author Views Date
Thread Problem with review mod. Bmxer 4961 Jan 9, 2002, 2:32 PM
Thread Re: [Bmxer] Problem with review mod.
Paul 4903 Jan 9, 2002, 2:49 PM
Thread Re: [RedRum] Problem with review mod.
Bmxer 4865 Jan 9, 2002, 3:03 PM
Thread Re: [Bmxer] Problem with review mod.
sponge 4902 Jan 9, 2002, 3:17 PM
Thread Re: [ThatPerson1024] Problem with review mod.
Bmxer 4856 Jan 9, 2002, 3:36 PM
Thread Re: [Bmxer] Problem with review mod.
Bmxer 4866 Jan 9, 2002, 3:39 PM
Thread Re: [Bmxer] Problem with review mod.
sponge 4890 Jan 9, 2002, 4:22 PM
Post Re: [ThatPerson1024] Problem with review mod.
Paul 4879 Jan 9, 2002, 5:39 PM
Thread Re: [ThatPerson1024] Problem with review mod.
Bmxer 4830 Jan 9, 2002, 6:29 PM
Thread Re: [Bmxer] Problem with review mod.
Bmxer 4848 Jan 9, 2002, 7:47 PM
Thread Re: [Bmxer] Problem with review mod.
Paul 4857 Jan 10, 2002, 3:42 AM
Thread Re: [RedRum] Problem with review mod.
Bmxer 4860 Jan 10, 2002, 8:56 AM
Post Re: [Bmxer] Problem with review mod.
Bmxer 4825 Jan 11, 2002, 2:56 PM