Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

star rating

Posted on 2011-10-01
16
Medium Priority
?
459 Views
Last Modified: 2012-06-27
how do i create a star rating in php?

thanks in advance for your help!
0
Comment
Question by:only1wizard
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 8
16 Comments
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 36896678
You would use a small data base table and a handful of graphics.  As members vote you update the data base table.  As each page is created, you choose the graphic based on the average of the votes.

The design for counting and reporting the votes is shown in this article.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/PHP_Databases/A_5256-Simple-Vote-Counting-in-PHP-and-MySQL.html
0
 

Author Comment

by:only1wizard
ID: 36896812
thanks i already understand the concept of how to create the back bone of the voting system now i need to know how to incorporate the images into the voting system so it can be ranked by stars(avg. count).

thanks in advance for your help!
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 36896916
I will upload some images here that you can use.  Back in a minute...
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 111

Expert Comment

by:Ray Paseur
ID: 36896954
Here's the PSD file with the star layers.  You can resize it to suit your application needs and save the layers as PNG images
star-template.psd
0
 

Author Comment

by:only1wizard
ID: 36897006
thank you for your help!
0
 

Author Comment

by:only1wizard
ID: 36897095
are you working on a way to incorporate these into the app?
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 36897682
Yes, I will post an update version in the article soon.
0
 

Author Comment

by:only1wizard
ID: 36897684
thank u
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 36898105
0
 

Author Comment

by:only1wizard
ID: 36898214
ok thanks for the update.

how ever the images are not being returned correctly. here is the path in .php

// CREATE A LINK TO A FIVE-STAR RATINGS IMAGE
    $x = str_pad($x, 2, '0', STR_PAD_LEFT);
    $stars[$color]
    = './RAY_EE_images/stars'
    . $x
    . '.png'
    ;

Open in new window


i labeled it stars because the layers are labeled that way.

here is the view source:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<body>
<br/><img src="./RAY_EE_images/stars50.png" /> Red HAS RECEIVED 9 VOTES 
<br/><img src="./RAY_EE_images/stars20.png" /> Orange HAS RECEIVED 4 VOTES 
<br/><img src="./RAY_EE_images/stars05.png" /> Yellow HAS RECEIVED 1 VOTES 
<br/><img src="./RAY_EE_images/stars05.png" /> Green HAS RECEIVED 1 VOTES 
<br/><img src="./RAY_EE_images/stars10.png" /> Blue HAS RECEIVED 2 VOTES 
<br/><img src="./RAY_EE_images/stars10.png" /> Indigo HAS RECEIVED 2 VOTES 
<br/><img src="./RAY_EE_images/stars05.png" /> Violet HAS RECEIVED 1 VOTES 
<form method="post"><br/>VOTE FOR YOUR FAVORITE COLORS
<br/><input type="checkbox" name="color_selections[Red]" />Red
<br/><input type="checkbox" name="color_selections[Orange]" />Orange
<br/><input type="checkbox" name="color_selections[Yellow]" />Yellow
<br/><input type="checkbox" name="color_selections[Green]" />Green
<br/><input type="checkbox" name="color_selections[Blue]" />Blue
<br/><input type="checkbox" name="color_selections[Indigo]" />Indigo
<br/><input type="checkbox" name="color_selections[Violet]" />Violet
<br/><input type="submit" value="VOTE NOW" />
</form></body>
</html>

Open in new window


i dont have all those images in that folder. how do i extract each layer for that purpose?


thanks in advance for your help!
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 36898216
Do you have a copy of Photoshop?

If so, you would make all of the layers invisible except for the one you wanted to see.  Then you would save the image as a PNG.  There are 11 layers that matter.

If you do not have Photoshop, I can upload a collection of images for you.  These will be 80 pixels wide by 16 pixels high, as shown in the screen capture in the article.  But going forward if you are going to develop web sites you might want to buy Photoshop or get to be good friends with a designer who has a copy.
0
 

Author Comment

by:only1wizard
ID: 36898217
no i have photoshop just new to it how do i make them disappear? the layers that is?
0
 

Author Comment

by:only1wizard
ID: 36899190
i figured it out i will post my results once i test it thanks!
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 36899202
XLNT.  Photoshop can take some time to learn, but once you get the concepts of layers and masks, a lot of creative opportunity opens up!
0
 

Author Closing Comment

by:only1wizard
ID: 36899206
thanks for your help this is a nice stepping stone for me!
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 36899223
Thanks for the points -- it's a great question! ~Ray
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question