PHP Web Host - Quality Web Hosting For All PHP Applications Clan Themes! We make clans look good!!
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
blith
Client


Joined: Jul 18, 2003
Posts: 977

PostPosted: Fri May 21, 2004 2:27 pm Reply with quote Back to top

I have 7.2 and I am not sure if this is the case in all versions but when you submit a review it ask for a rating from 1-10 but then when it posts said review it translates your rating into stars. 1 gives half a star and two gives a full star, 3 a star and a half so and so on. What I would like to know is there a way to modify this so that you either get 10 stars or give a rating from 1-5 which then translates into stars? Thanks.
Here is the code:
Code:
function display_score($score) {
    $image = "<img src=\"images/blue.gif\" alt=\"\">";
    $halfimage = "<img src=\"images/bluehalf.gif\" alt=\"\">";
    $full = "<img src=\"images/star.gif\" alt=\"\">";

    if ($score == 10) {
   for ($i=0; $i < 5; $i++)
       echo "$full";
    } else if ($score % 2) {
   $score -= 1;
   $score /= 2;
   for ($i=0; $i < $score; $i++)
       echo "$image";
       echo "$halfimage";
    } else {
   $score /= 2;
   for ($i=0; $i < $score; $i++)
       echo "$image";
}

I am looking at it and it makes a little sense but if anyone can help I would appreciate it.
View user's profile Send private message Visit poster's website
sixonetonoffun
Spouse Contemplates Divorce


Joined: Jan 02, 2003
Posts: 2499

PostPosted: Fri May 21, 2004 5:47 pm Reply with quote Back to top

I don't follow you exactly either you want to do away with the half stars is the idea?
So a rating of 5 = 5 stars and a rating of 10 =10 stars?

try this should work no promises so backup?
Code:

function display_score($score) {
    $image = "<img src=\"images/blue.gif\" alt=\"\">";
    $halfimage = "<img src=\"images/bluehalf.gif\" alt=\"\">";
    $full = "<img src=\"images/star.gif\" alt=\"\">";

    if ($score == 10) {
   for ($i=0; $i < 10; $i++)
       echo "$full";
    } else if ($score % 2) {
        $score = $score;
//   $score -= 1;
//   $score /= 2;
   for ($i=0; $i < $score; $i++)
       echo "$image";
    //   echo "$halfimage";
    } else {
//   $score /= 2;
   for ($i=0; $i < $score; $i++)
       echo "$image";
    }
}
View user's profile Send private message
blith
Client


Joined: Jul 18, 2003
Posts: 977

PostPosted: Sat May 22, 2004 4:56 pm Reply with quote Back to top

That worked great! But how can I just have a 1-5 scale and 1 star for each point? Rated 1 gives 1 star rated 2 gives 2 stars all the way to five...
View user's profile Send private message Visit poster's website
sixonetonoffun
Spouse Contemplates Divorce


Joined: Jan 02, 2003
Posts: 2499

PostPosted: Sat May 22, 2004 5:16 pm Reply with quote Back to top

Just remove the 6-10 options from the form. Change the 10's to 5's in the function display_score. Should be good to go then I'd think.
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum