Author Topic: [MOD] Hot or Not Rating  (Read 67496 times)

0 Members and 1 Guest are viewing this topic.

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
[MOD] Hot or Not Rating
« on: January 25, 2006, 05:16:48 PM »
MOD WORKS ONLY ON 1.7.1! - NO SUPPORT FOR NEWER VERSIONS OF 4IMAGES!


Info:
 I've searched the whole forum about any related topic, yes there are, but no working ones (for me), one is in spanish, the other is making errors, so i worked a little bit and (with the help of V@no) combine some stuff to get a working "Hor or Not" MOD. There were many requests for such a MOD, so here it is.

The MOD:
User opens detailed version of an image, instead of the rating button, he sees radio-buttons from 1 to 5 (or more if you change the rating) above the image. After clicking on a radio-button, the rating is added to the database and he will be automaticly redirected to the next image in the category (folder), if there is one.

Demo:
official version: www.hotornot.com
4images: www.zapomnime.com *user name "test", password "test"*

Required MODs
http://www.4homepages.de/forum/index.php?topic=7493.0

Changed files:
/templates/rate_form.html
/templates/details.html
/details.php

Tested on 4images 1.7.1 with Firefox & IE

--------------------------------------------------------------------------------------------------------------------------------------------------------

1.
open details.php

find:
Code: [Select]
show_image($image_row, $mode, 0, 1);
move below:
Code: [Select]
unset($next_prev_cache);
save file

2.
open details.html

find:
Code: [Select]
{image}
replace with:
Code: [Select]
{if next_image_url}<a href="{next_image_url}">{endif next_image_url}
   {if_rate_form} {rate_form} {end_if_rate_form}  {image}
{if next_image_url}</a>{endif next_image_url}
{lang_image_rating}: {image_rating} ({image_votes} {lang_votes})<img src="{template_url}/images/{rating_pic}" alt="" />

Add "<img src="{template_url}/images/{rating_pic}" alt="" />" only if you've installed Nicky's  "Star Rating MOD" http://www.4homepages.de/forum/index.php?topic=923.msg3990#msg3990 If not, delete it.

find:
Code: [Select]
{if rate_form}
<div align="center">{rate_form}</div>
 {endif rate_form}

delete it, or leave it if you want a second rate form under the image.

save file

3.
open rate_form.html

find:
Code: [Select]
<form method="post" action="{self}">
There are two ways for the next step:

a)
if you applyed fix [1.7.1] Conditional tags inside other conditional tags + {ifno ...}{endifno ...} http://www.4homepages.de/forum/index.php?topic=7493.0

replace with:
Code: [Select]
<FORM action={if next_image_url}{next_image_url}{endif next_image_url}{ifno next_image_url}{self}{endifno next_image_url}  method=post target=_top>

b)
If you haven't applied that fix

replace with:
Code: [Select]
<FORM action={if next_image_url}{next_image_url}&{endif next_image_url}{self} method=post target=_top>



find:
Code: [Select]
  <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="">--</option>
                <option value="5">5</option>
                <option value="4">4</option>
                <option value="3">3</option>
                <option value="2">2</option>
                <option value="1">1</option>
              </select>
            </td>
            <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>


replace with:
Code: [Select]
  <TABLE borderColor=#000000 cellSpacing=0 cellPadding=0 width=450>
    <TBODY>
      <TR vAlign=top>
        <TD align=top width="440"> <TABLE borderColor=#000000 cellSpacing=0 cellPadding=1 width="100%"  class="head2">
            <TBODY>
              <TR vAlign=top>
                <TD align=middle> <TABLE width=445 border=0>
                    <TBODY>
                      <TR>
                        <TD align=middle colSpan=3 width="445"> <b>Vote!</b></font></TD>
                      </TR>
                      <TR>
                        <TD width="62"></TD>
                        <TD align=middle width="319"> <table border="0" cellspacing="1" width="100%">
                            <tr>
                              <td align="center">1</td>
                              <td align="center">2</td>
                              <td align="center">3</td>
                              <td align="center">4</td>
                              <td align="center">5</td>
                            </tr>
                            <tr>


                              <td><input onclick=submit() type="radio" value="1" name="rating" ></td>
                              <td><input onclick=submit() type="radio" value="2" name="rating"></td>
                              <td><input onclick=submit() type="radio" value="3" name="rating"></td>
                              <td><input onclick=submit() type="radio" value="4" name="rating"></td>
                              <td><input onclick=submit() type="radio" value="5" name="rating"></td>

                            </tr>

                          </table></TD>
                        <TD width="29"></TD>
                      </TR>
                      <TR>
                        <TD width="62"><FONT color=#006699 size=2><B>NOT</B></FONT></TD>
                        <TD align=middle width="319"> <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
                            <TBODY>
                              <center><img src="{template_url}/images/hotornotback.gif" border="0" alt="" /></center>
                            </TBODY>
                          </TABLE></TD>
                        <TD width="29"><FONT color=#cc3300 size=2><B>HOT</B></FONT></TD>
                      </TR>
                    </TBODY>
                  </TABLE></TD>
              </TR>
            </TBODY>
          </TABLE></TD>
      </TR>
    </TBODY>
  </TABLE>
  <input type="hidden" name="action" value="rateimage">
  <input type="hidden" name="id" value="{image_id}">

Thats just a sample html, you have to change some details if youre using an other template or want (f.e.) a smaller box etc. Also you have to change the words "Vote!", "Hot" and "Not" above to whatever you like. If you want to have more voting options (e.g. 1 - 10) check this topic http://www.4homepages.de/forum/index.php?topic=6674.0

save file

upload the "hotornotback.gif" into your template/.../images folder. You can make one on you own in Photoshop, or just use this (for a 1 - 12 rating system):



Your done! Thanks a lot to V@no (who wrote the redirect function) and to Lavazza (Yes coffee is important when you code)  :lol:

« Last Edit: January 03, 2007, 02:06:30 PM by trez »

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [MOD] Hot or Not Rating (working)
« Reply #1 on: January 25, 2006, 05:29:43 PM »
The day has come. 8)

Finally, all there's left is to put these results within the user's profile. :D

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: [MOD] Hot or Not Rating (working)
« Reply #2 on: January 25, 2006, 10:27:55 PM »
Finally, all there's left is to put these results within the user's profile. :D

You mean something like - User Profile -> show pictures submitted by user with rating OR User Profile -> Show best rated images etc?

Dont understand :D

PS: 36 hits on my page from this forum since posting that topic, 5 mails Sp, please allow me to answer you before you write me:
NO, i'am not translating that page into english, and YES, we have the most beautyfull women here in Bulgaria (Russia too ;) ) :D :D

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [MOD] Hot or Not Rating (working)
« Reply #3 on: January 25, 2006, 11:48:13 PM »
Quote

User Profile -> show pictures submitted by user with rating


Right. This one. Sorry for the mis-information. ;)

Quote

and YES, we have the most beautyfull women here in Bulgaria (Russia too Wink )


Well, isn't that interesting ? ! :mrgreen:

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: [MOD] Hot or Not Rating (working)
« Reply #4 on: January 26, 2006, 12:15:53 AM »
Quote
Right. This one. Sorry for the mis-information. ;)

Its allready done if the user installs the star rating MOD, the "show pictures submitted by user" MOD, and puts the rating stars into the thumbnail_bit :)

Quote
Well, isn't that interesting ? ! :mrgreen:

 :lol: :lol:


Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [MOD] Hot or Not Rating (working)
« Reply #5 on: January 26, 2006, 12:20:32 AM »
Good point. How about this one ?

Quote

Show best rated images etc?


;)

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: [MOD] Hot or Not Rating (working)
« Reply #6 on: January 26, 2006, 01:38:37 AM »
Good point. How about this one ?

Quote

Show best rated images etc?


;)

Hm, of course, i'am a PHP newbie, but i think when we modify the MOD that shows the top-images in the actual category. EG: insted of "xxx.com/4images/top.php?cat_id=1" "xxx.com/4images/top.php?user_id=1"  But i still don't figured out how to modify the code in the php files - thats something you understand much better ;)

Offline MEXX

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: [MOD] Hot or Not Rating (working)
« Reply #7 on: January 28, 2006, 04:50:06 AM »
А я что то не найду в details.php этой строки:
Quote
show_image($image_row, $mode, 0, 1);
   

Offline Q-man

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: [MOD] Hot or Not Rating (working)
« Reply #8 on: January 28, 2006, 02:57:36 PM »
comes this mod with "show rates in top images"?

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: [MOD] Hot or Not Rating (working)
« Reply #9 on: January 29, 2006, 09:55:21 AM »
comes this mod with "show rates in top images"?

Quote
Add "<img src="{template_url}/images/{rating_pic}" alt="" />" only if you've installed Nicky's  "Star Rating MOD" http://www.4homepages.de/forum/index.php?topic=923.msg3990#msg3990 If not, delete it.
[/i]

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: [MOD] Hot or Not Rating (working)
« Reply #10 on: January 29, 2006, 10:01:12 AM »
А я что то не найду в details.php этой строки:
Quote
show_image($image_row, $mode, 0, 1);


Пробуйте найти show_image($image_row, $mode, 0, 1);

В противном случае возможно ты устанавливал МОД, который изменился, та линия (спроси V@no)


Offline chris19

  • Pre-Newbie
  • Posts: 2
    • View Profile
Re: [MOD] Hot or Not Rating (working)
« Reply #11 on: January 31, 2006, 02:19:23 AM »
show_image($image_row, $mode, 0, 1);

I can't find this line. I looked at the script and again. I just can't find it.  Can someone help me where can find this line somewhere?

Thanks in advance.

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [MOD] Hot or Not Rating (working)
« Reply #12 on: January 31, 2006, 02:28:38 AM »
Quote

I can't find this line. I looked at the script and again. I just can't find it.  Can someone help me where can find this line somewhere?


Line 68 in details.php (from the original package). ;)

Offline chris19

  • Pre-Newbie
  • Posts: 2
    • View Profile
Re: [MOD] Hot or Not Rating (working)
« Reply #13 on: January 31, 2006, 02:52:06 AM »
thanks, It's working fine.

Offline insane

  • Newbie
  • *
  • Posts: 47
    • View Profile
    • Gallery
Re: [MOD] Hot or Not Rating (working)
« Reply #14 on: January 31, 2006, 06:26:32 PM »
He always says i have to complete my topic and comment field?!
he doesn't get my vote :( what to do?