Hi, on my top rated page the rating is out of 10, how can I make a simple global so it returns out of 5? Thanks in advance.
Aug 9, 2004, 8:51 AM
Veteran / Moderator (18441 posts)
Aug 9, 2004, 8:51 AM
Post #2 of 2
Views: 1113
heheh.. nice and simple;
my $rating = sprintf "%.2f", $_[0] / 2;
return $rating;
}
..and call with;
<%global_name($Rating)%>
Basically, it will split the rating in half, and then round it off to 2dp.
Hope that helps.
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!
Code:
sub { my $rating = sprintf "%.2f", $_[0] / 2;
return $rating;
}
..and call with;
<%global_name($Rating)%>
Basically, it will split the rating in half, and then round it off to 2dp.
Hope that helps.
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!