Jump to content

display images for rating system


toolman

Recommended Posts

Hi there,

 

I have a script that works out ratings. Its based on a 1-10 scale with havles, for example 1, 1.5, 2, 2.5 etc.

 

What I want to do is display "stars" instead of actual numbers.

 

Is there a way I can do this using an if statement, for example if the rating is 7.5, display 4 stars?

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/275214-display-images-for-rating-system/
Share on other sites

toolman: What I would do, is to give each half of the star a value of 1, then round off your score to the nearest whole number.

Incidentally, that means that you will never display half a star for the .5, seeing as .5 is actually a quarter of a star. If you had 6.5 stars, on the other hand, it would round up to 7 and thus give you three and a half stars.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.