• [Mod] Star Rating 5 0 5 1
Currently:  

Author Topic: [Mod] Star Rating  (Read 134743 times)

0 Members and 2 Guests are viewing this topic.

Offline e-trader_2002

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: [Mod] Star Rating
« Reply #75 on: September 07, 2006, 10:17:05 PM »
If somebody is interested in the code, leave me a message in this thread and I will post the necessary changes.

I'm interested ...  8O

Hi mawenzi,

add the red code-fragments to rate_form.html:

[qcode]
<form method="post" action="{self}">
  <table border="0" cellspacing="0" cellpadding="1">
    <tr>
      <td class="head1">
        <table border="0" cellspacing="0" cellpadding="3" class="row1">
          <tr>
            <td valign="bottom">
              <select name="rating" class="select">
                <option value="">{Please_rate}</option>
                <option id="apples_5x" value="5">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5 - {lang_top}</option>
                <option id="apples_4x" value="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4 - {lang_above_average}</option>
                <option id="apples_3x" value="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3 - {lang_average}</option>
                <option id="apples_2x" value="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 - {lang_below_average}</option>
                <option id="apples_1x" value="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 - {lang_flop}</option>
              </select>
            <td>
              <input type="hidden" name="action" value="rateimage" />
              <input type="hidden" name="id" value="{image_id}" />
              <input type="submit" value="{rate}" class="button" name="submit" />
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
</form>
[/qcode]

At the bottom of style.css add this:

[qcode]
/*--Rating--------------------------------------------------*/
#apples_1x {
   background-image:url(/4images/templates/Fruitsticker/images/apples_1x.gif);
   background-repeat:no-repeat;
}
#apples_2x {
   background-image:url(/4images/templates/Fruitsticker/images/apples_2x.gif);
   background-repeat:no-repeat;
}
#apples_3x {
   background-image:url(/4images/templates/Fruitsticker/images/apples_3x.gif);
   background-repeat:no-repeat;
}
#apples_4x {
   background-image:url(/4images/templates/Fruitsticker/images/apples_4x.gif);
   background-repeat:no-repeat;
}
#apples_5x {
   background-image:url(/4images/templates/Fruitsticker/images/apples_5x.gif);
   background-repeat:no-repeat;
}

[/qcode]

Necessary individual changes:

  • Use picture-files of your choice. It's cool to use .gif-pictures with transparent background for this.
  • You may change the names used as id (i. e. apples_3x) in both modules to whatever you like. They are not related to the names of the picture-files.
  • Insert as many &nbsp; ... &nbsp; as necessary into rate_form.html to move the follow-up text to the right far enough, so that it won't overlap with the picture
  • Reduce the height of the pictures you use, so that they will fit the height of the row-entries of the selection dropdown list
  • It should be more than easy :wink: to expand this MOD to more than 5 rating-ranks

That's all. And I think that's my first small 4images-MOD.

I hope many users will enjoy this and I would like a PM with a link to the site from everybody, who has implemented this MOD.

e-trader_2002
« Last Edit: September 07, 2006, 10:41:44 PM by e-trader_2002 »
A hobby is a great way to spent time you actually don't have! :wink:


Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [Mod] Star Rating
« Reply #76 on: September 08, 2006, 12:00:46 AM »
@ e-trader_2002 

... thanks for this tutorial ...  :D
... but it works unfortunately not in all browsers ...

... FF :  :thumbup: ...  :D
... IE :  :thumbdown: ...  :cry:
« Last Edit: September 08, 2006, 12:42:23 AM by mawenzi »
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Star Rating
« Reply #77 on: September 08, 2006, 01:27:20 AM »
Unfortunetly it doesnt work in opera either...
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline e-trader_2002

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
Re: [Mod] Star Rating
« Reply #78 on: September 09, 2006, 12:29:59 AM »
Hi,

sorry for not having tested with other browers than FF. :oops: But it works with :thumbup: Netscape 7.0x too. Maybe because Netscape uses the same or a very similar engine as FF as far as I know. And it causes no problems with IE; the grafics just aren't displayed.
So everybody can choose to use this little MOD and hope that future versions of IE and other browsers may support this feature.

e-trader_2002
A hobby is a great way to spent time you actually don't have! :wink:


Offline maus

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: [Mod] Star Rating
« Reply #79 on: June 09, 2007, 09:19:55 AM »
hallo


nur probeweise bei der details.html. auch die bilder ins image verzeichnis kopiert, aber ich sehe keine sternchen. bitte um hilfe

Offline e@agle

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: [Mod] Star Rating
« Reply #80 on: July 12, 2007, 04:37:49 PM »
can i see a demo pls, for what it's

Offline dMark

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: [Mod] Star Rating
« Reply #81 on: November 27, 2008, 11:18:03 AM »
in /includes/functions.php find:
Code: [Select]
"image_rating_round" => round($image_row['image_rating']),in templates:
Code: [Select]
<img src="{template_image_url}/{image_rating_round}.gif">
Images: 1.gif, 2.gif, 3.gif, 4.gif, 5.gif
works fine!!!

Default Rating 2.00...2.45=2.gif and 2.50...3.00=3.gif

V@no    how to make Rating 2.20...2.80=2.5.gif ? Where to file 1.5.gif, 2.5.gif, 3.5.gif, 4.5.gif, 5.5.gif
Help me. Sorry for bad English



Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Star Rating
« Reply #82 on: November 27, 2008, 07:57:47 PM »
Hello and welcome to 4images forum.

First of all, please read our forum rules (link in my signature). This is regarding the PM you've sent.

Second, replace:
Code: [Select]
  if ($image_row['image_rating'] == '5.00') {
     $rating_pic = "5.gif";
  } elseif ($image_row['image_rating'] >= '4.00') {
     $rating_pic = "4.gif";
  } elseif ($image_row['image_rating'] >= '3.00') {
     $rating_pic = "3.gif";
  } elseif ($image_row['image_rating'] >= '2.00') {
     $rating_pic = "2.gif";
  } elseif ($image_row['image_rating'] >= '1.00') {
     $rating_pic = "1.gif";
  } else {
     $rating_pic = "0.gif";
  }

With this:
Code: [Select]
  $ratings = array("0", "0.5", "1", "1.5", "2", "2.5", "3", "3.5", "4", "4.5", "5");
  foreach ($ratings as $num)
  {
    if ($image_row['image_rating'] >= $num)
    {
      $rating_pic = $num;
    }
  }
  $rating_pic .= ".gif";
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline dMark

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: [Mod] Star Rating
« Reply #83 on: November 28, 2008, 01:19:18 PM »
this:
Code: [Select]
  $ratings = array("0", "0.5", "1", "1.5", "2", "2.5", "3", "3.5", "4", "4.5", "5");
  foreach ($ratings as $num)
  {
    if ($image_row['image_rating'] >= $num)
    {
      $rating_pic = $num;
    }
  }
  $rating_pic .= ".gif";



Has not understood. In what file to change these lines??? :oops:

I do not have this:
Code: [Select]
  if ($image_row['image_rating'] == '5.00') {
     $rating_pic = "5.gif";
  } elseif ($image_row['image_rating'] >= '4.00') {
     $rating_pic = "4.gif";
  } elseif ($image_row['image_rating'] >= '3.00') {
     $rating_pic = "3.gif";
  } elseif ($image_row['image_rating'] >= '2.00') {
     $rating_pic = "2.gif";
  } elseif ($image_row['image_rating'] >= '1.00') {
     $rating_pic = "1.gif";
  } else {
     $rating_pic = "0.gif";
  }

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Star Rating
« Reply #84 on: November 28, 2008, 06:36:51 PM »
install the mod from the first page and you should have this.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Anarchology

  • Jr. Member
  • **
  • Posts: 60
  • I LULZ too much!
    • View Profile
    • Tainted Pix
Re: [Mod] Star Rating
« Reply #85 on: January 09, 2009, 02:43:16 AM »
EDIT: Oops, I put this in the wrong topic thread!
A personal THANK YOU to all of the great programmers on this site for helping me get my site from something basic to what it is today!

My site: http://taintedpix.com
(warning: some adult content)

Offline ashfaq

  • Full Member
  • ***
  • Posts: 128
    • View Profile
Re: [Mod] Star Rating
« Reply #86 on: January 09, 2009, 08:19:34 AM »

// upload pics into your /templates/YOURTEMPLATE/images / uploade die bilder ins /templates/DEINTEMPLATE/images

// DEMO: no more available / nicht mehr verfügbar

Where are the star rank pictures to download ?

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [Mod] Star Rating
« Reply #87 on: January 09, 2009, 09:15:52 AM »
Where are the star rank pictures to download ?

... here ... at the bottom ...
... there are 6 nice star rank images with white background ( ok ... looks like one image, but there are 6 images ... ;) ) ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline ashfaq

  • Full Member
  • ***
  • Posts: 128
    • View Profile
Re: [Mod] Star Rating
« Reply #88 on: January 09, 2009, 05:22:09 PM »
Thanks mawenzi it really works but i need some modifications if you plz help.. i add code at thumbnail_bit.html

1: How enable it to also rate at category.html by hover on stars on thumbnails as now its only show rates given by details page?
2: What to do that registered users or guests also rate from category thumbnails page ? (Two modifications for guest & users)
3: Are there any more beautifull rank images in small sizes like given in topic ?
« Last Edit: January 09, 2009, 06:12:24 PM by ashfaq »

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [Mod] Star Rating
« Reply #89 on: January 09, 2009, 06:30:31 PM »
@ ashfaq

... why you don't use the ajax starrating mod by KurtW ... ?
... http://www.4homepages.de/forum/index.php?topic=17829.0 ...
... this version of image rating will solved all your problems ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...