Hi,
I'm using a global (originally posted by Andy) that I've slightly modified to display the last 10 reviews posted. I must warn you my Perl coding skills are fairly rudimentary to say the least so I'm not sure how good the coding is...
At the moment this works to a certain extent in that it displays the Review author, subject and date but not the link title the review refers to.
my ($output,$hit);
my $table = $DB->table('Reviews');
$table->select_options('ORDER BY Review_Date','DESC','LIMIT 10');
# Only select validated reviews
my $sth = $table->select({Review_Validated => 'Yes'}) || return $GT::SQL::error;
while (my $hit = $sth->fetchrow_hashref()) {
# Modify short date format to mini format
$hit->{Review_Date}=GT::Date::date_transform($hit->{Review_Date},"%yyyy%-%mm%-%dd%","%dd% %mmm% %yy%");
$output .= Links::SiteHTML::display('newreviewsdate', $hit);
}
return $output;
}
So I'd like to find a way to integrate into this global a query to get the <%Title%> of the link the reviews refer to.
I tried adding this :
since the Review_LinkID is the same as the link $ID but can't figure out whether there needs to be another database query to the Links table in order to get the Title or not.
Does anybody have an idea on where I should be looking ?
Thanks, John
Significant Media
I'm using a global (originally posted by Andy) that I've slightly modified to display the last 10 reviews posted. I must warn you my Perl coding skills are fairly rudimentary to say the least so I'm not sure how good the coding is...
At the moment this works to a certain extent in that it displays the Review author, subject and date but not the link title the review refers to.
Code:
sub { my ($output,$hit);
my $table = $DB->table('Reviews');
$table->select_options('ORDER BY Review_Date','DESC','LIMIT 10');
# Only select validated reviews
my $sth = $table->select({Review_Validated => 'Yes'}) || return $GT::SQL::error;
while (my $hit = $sth->fetchrow_hashref()) {
# Modify short date format to mini format
$hit->{Review_Date}=GT::Date::date_transform($hit->{Review_Date},"%yyyy%-%mm%-%dd%","%dd% %mmm% %yy%");
$output .= Links::SiteHTML::display('newreviewsdate', $hit);
}
return $output;
}
So I'd like to find a way to integrate into this global a query to get the <%Title%> of the link the reviews refer to.
I tried adding this :
Code:
my $sth = $table->select({Review_Validated => 'Yes'},{ Review_LinkID => $ID }) || return $GT::SQL::error;Does anybody have an idea on where I should be looking ?
Thanks, John
Significant Media