SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2007
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Rating script display stars

    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, and also using half stars and only 5 stars?

    Thanks.

  2. #2
    SitePoint Zealot
    Join Date
    Jul 2012
    Location
    Scarborough, North Yorkshire, United Kingdom
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ebsolutions View Post
    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, and also using half stars and only 5 stars?

    Thanks.
    Are we talking PHP?
    Richard
    Resell SSL Certificates - API / WHMCS / HostBill / ClientExec
    ServerTastic - RapidSSL, Geotrust, Thawte, Symantec, SmarterTools and more

  3. #3
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,941
    Mentioned
    215 Post(s)
    Tagged
    12 Thread(s)
    I would create a div element, take an image (jpeg or whatever) of five stars, then set that image as the background of the div. Depending on how many stars you want to display, you just have to set the width of the div accordingly.

  4. #4
    SitePoint Enthusiast
    Join Date
    May 2011
    Posts
    55
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi ebsolutions,

    One more but quite length option is that you can make switch cases and set the div or div content.
    PHP Programming Its more than just writing code


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •