Home : Products : Gossamer Links : Discussions :

Products: Gossamer Links: Discussions: Short review_contents in "all reviews"-global: Edit Log

Here is the list of edits for this post
Short review_contents in "all reviews"-global
Hi,
I'm using the global below, to show the title of all reviews on a page.
Is it possible to show a short part (50 signs) of the review (Review_Contents) under each title? May be with a link called "more" to the whole review?

The global All_Reviews

Code:
sub {
my (@links,$sth,$link);
my $search_db = $DB->table('Links','Reviews');
$search_db->select_options ("ORDER BY Review_Date DESC");
$sth = $search_db->select ( { Review_Validated => 'Yes' });
while (my $link = $sth->fetchrow_hashref()) {
if (length $link->{Title} > 70) {
$link->{Title} = substr($link->{Title}, 0, 50) . '...';}
$link = Links::SiteHTML::tags('link', $link);
push@links, $link;
}
return {All_Reviews=>\@links};<br>
}



And the loop in the template

Code:
<p><%All_Reviews%>
<%loop All_Reviews%>
<a href="<%config.db_cgi_url%>/review.cgi?ID=<%ID%>"><%Title%></a><br>
<img src="<%Links::Utils::image_url("stars-5-${Review_Rating}.gif")%>" align="top" title="<%Review_Rating%> von 5" />
<b><%Review_Subject%></b> von <%if Review_GuestName%><%Review_GuestName%><%else%><%Review_Owner%><%endif%>
<a href="<%config.db_cgi_url%>/review.cgi?ID=<%ID%>"></a><br/><br/>
<%endloop%>
</p>


Thanks
Matthias

Matthias
gpaed.de

Last edited by:

Matthias70: Oct 23, 2007, 10:56 AM

Edit Log: