Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Hide Rating and Votes Unless Greater Than 0

Quote Reply
Hide Rating and Votes Unless Greater Than 0
I'm kind an idiot when it comes to things like this, but I want to make it so that the Rating and Votes do not display unless they are greater than 0.00. This of course would mean someone would have to vote before it would show up. I have tried creating to globals, one called 'beenvoted' and 'beenrated' and included some like the following to make it work:

Quote:


sub {

my ($rec) = @_;

if ($rec->{'Rating'} eq '0.00') { return ; }
else {'Rating: <%Rating%>'; }
}


and then on the links.html template I have (Added: <%Add_Date%> <%beenrated%> <%beenvoted%>)

It will show (Added: Thu Apr 03 2003) if there are no votes or ratings (which is what I want), but if there are votes or ratings it shows (Added: Thu Apr 03 2003 Rating: Votes: )

Can anyone help me fix this? Thanks!
Quote Reply
Re: [eclipse] Hide Rating and Votes Unless Greater Than 0 In reply to
You don't need a global. In the template just do something like:

<%if Rating > '0.00'%> <%Rating%> <%endif%>
Quote Reply
Re: [eclipse] Hide Rating and Votes Unless Greater Than 0 In reply to
Could try this in link.html;

<%if Rating != 0%>
stuff to show rating
<%else%>
Not rated yet
<%endif%>

This probably wouldn't work if someone entered a 0 value for the rating...as 'Rating' would still hold 0 for the links rating.

Just giving some ideas....it may be easier to do something in the templates, than creating a global Smile

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: [Andy] Hide Rating and Votes Unless Greater Than 0 In reply to
FWIW, this is what I use: (anything with less than two votes just does not get shown)



<%if Votes < 2.1%>

There have not yet been any votes for "<B><%Title%></B>".

<%endif%>

<%if Votes > 2.1%>

BCDB Filmography Score: <A HREF="<%db_cgi_url%>/rate.cgi?ID=<%ID%>"><IMG SRC="http://www.bcdb.com/pages/images/rate<%rate_img%>.gif" WIDTH=55 HEIGHT=10 BORDER=0 ALT="<%Rating%>"></A> (There have been <%Votes%> votes so far.)

<%endif%>

dave

Big Cartoon DataBase
Big Comic Book DataBase
Quote Reply
Re: [eclipse] Hide Rating and Votes Unless Greater Than 0 In reply to
Thanks for the help everyone! Worked like a charm! See, I told you I was an idiot!