Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Show all reviews

Quote Reply
Show all reviews
If I want to show all reviews in the directory
Code:
review.cgi?ReviewID=*
works fine until there is only 1 review/link.

If there are 2 or more reviews, the link to detailed page, for example
Code:
jump.cgi?Detailed=96
is OK only for the first review. The second one shows
Code:
jump.cgi?Detailed=
without the link ID.

Is something wrong with the review_include.html or link.html template?
Quote Reply
Re: [katakombe] Show all reviews In reply to
Hi Katakombe,
I'm using this global to show all my reviews in a new template

global
Latest_Revs

Code:
sub {
my (@links,$sth,$link);
my $search_db = $DB->table('Links','Reviews');
$search_db->select_options ("ORDER BY Review_Date DESC","LIMIT $_[0]");
$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 {Latest_Revs=>\@links};<br>
}


Call it in a new template with this code. Changing the 50 will show more or less reviews

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

Matthias

Matthias
gpaed.de
Quote Reply
Re: [Matthias70] Show all reviews In reply to
Hi,

If you want to show all of the reviews, just use:

Code:
$search_db->select_options ("ORDER BY Review_Date DESC");

..instead of:

Code:
$search_db->select_options ("ORDER BY Review_Date DESC","LIMIT $_[0]");

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Matthias70] Show all reviews In reply to
Hello Matthias70!

Thanks, this is a really nice and cool global and I'll use it on my site CoolSmile.

Beside of that, I'm still interested is there any answer on my first question?