Results 1 to 10 of 10

Thread: How to do AWS stars

  1. #1
    Administrator Chris's Avatar
    Join Date
    Feb 2003
    Location
    East Lansing, MI USA
    Posts
    7,055

    How to do AWS stars

    How to change numeric customer ratings to stars:

    Code:
    #startop{
    z-index: 1;
    background-image: url("/images/staryellow.gif");
    background-repeat: repeat-x;
    height: 12px;
    }
    #starbottom{
    z-index: 0;
    background-image: url("/images/stargrey.gif");
    background-repeat: repeat-x;
    width: 65px;
    height: 12px;
    }
    The two star images are 13x12

    Code:
    $width = $Rating[$m] * 13;
    echo '<div id = "starbottom"><div id = "startop" style = "width: '.$width.'px;"></div></div>';
    Short and sweet.

    Any questions?
    Chris Beasley - My Guide to Building a Successful Website[size=1]
    Content Sites: ABCDFGHIJKLMNOP|Forums: ABCD EF|Ecommerce: Swords Knives

  2. #2
    Registered Mike's Avatar
    Join Date
    May 2003
    Location
    UK
    Posts
    2,755
    Nice

    I'll add that when I get back from holiday next week.
    Don't you just love free internet games ?

  3. #3
    Registered Member incka's Avatar
    Join Date
    Aug 2003
    Location
    Wakefield, UK, EU
    Posts
    3,801
    I'll add it when I've uploaded my site...

  4. #4
    Registered GCT13's Avatar
    Join Date
    Aug 2003
    Location
    NYC
    Posts
    480
    I like that technique.
    ....

  5. #5
    Administrator Chris's Avatar
    Join Date
    Feb 2003
    Location
    East Lansing, MI USA
    Posts
    7,055
    Oh, by the way, you can nab the star images from my kitchen site (#14 in my signature).
    Chris Beasley - My Guide to Building a Successful Website[size=1]
    Content Sites: ABCDFGHIJKLMNOP|Forums: ABCD EF|Ecommerce: Swords Knives

  6. #6
    Registered flyingpylon's Avatar
    Join Date
    Sep 2003
    Location
    Fishers, IN USA
    Posts
    144
    Yeah, that's an interesting way to do it. It took me a little while to figure out what you were actually doing. My site just pulls the star images from Amazon and displays them, and they go to half-star increments. This method is more "accurate" but I'm not sure anyone would be able to see the difference unless they really looked. It might be easier to see the differences in a segmented bar or something. If nothing else, it's fewer lines of code.

  7. #7
    Administrator Chris's Avatar
    Join Date
    Feb 2003
    Location
    East Lansing, MI USA
    Posts
    7,055
    With larger stars its easier to see too.
    Chris Beasley - My Guide to Building a Successful Website[size=1]
    Content Sites: ABCDFGHIJKLMNOP|Forums: ABCD EF|Ecommerce: Swords Knives

  8. #8
    Banned
    Join Date
    Dec 2003
    Posts
    152
    I'd just repeat the IMG tag. If the CSS doesn't load, isn't support, is turned off, etc., it breaks.

  9. #9
    Administrator Chris's Avatar
    Join Date
    Feb 2003
    Location
    East Lansing, MI USA
    Posts
    7,055
    You can't turned CSS off. If it is included on the page itself it can't not load. If it doesn't load hopefully more is messed up than just some stars.

    As for browsers that do not support it. At one point you just gotta write them off. You cannot continue to support browsers that are nearing a decade in age.
    Chris Beasley - My Guide to Building a Successful Website[size=1]
    Content Sites: ABCDFGHIJKLMNOP|Forums: ABCD EF|Ecommerce: Swords Knives

  10. #10
    Banned
    Join Date
    Dec 2003
    Posts
    152
    I know I've seen options in browsers (Mozilla, Firebird, Opera, maybe even IE) to enable/disable CSS and/or specify alternate/overriding stylesheets.

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
  •