• [MOD] Using Ajax Star Ratings MOD in Category Listings 4 0 5 1
Currently:  

Author Topic: [MOD] Using Ajax Star Ratings MOD in Category Listings  (Read 14568 times)

0 Members and 1 Guest are viewing this topic.

Offline eeyipes

  • Pre-Newbie
  • Posts: 7
    • View Profile
[MOD] Using Ajax Star Ratings MOD in Category Listings
« on: August 28, 2009, 09:44:04 PM »
Hello . . .  I've installed the Ajax Star Ratings MOD by Bash-T on my details. html template and it works great . . .

I would also like to use the star ratings in my thumbnail_bit template for use in category and new images listings.

I've added the appropriate files in the appropriate places, but the star rating only works for the first image listed on the page, the other rating stars are "dead".

I've been enlightened by Bash-T, since I know nothing of this stuff, that the object element YAHOO. rating. star in the details. html is only for use with one instance with the  rating script, hence the first instance it is called on it works, the rest you're out of luck.  He suggested using multiple instances of the object element, but the ajaxrating. js  files uses absolute form fields and would have to be tweaked.

If you haven't guessed already, I really don't know what I'm talking about and am just passing what I've been told.   :)

Has anyone out there gotten this mod to work in a category listings settings, or is anyone interested in taking on this challenge? It's a nice mod and it'd be great if we could use it in multiple instances on the same page.

Thanks!



Offline bash-t

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Need Help w/ Using Ajax Star Ratings MOD in Category Listings
« Reply #1 on: August 29, 2009, 01:01:04 AM »
Lucky you, I just developed an extension of my Ajax Star Rating Mod, so you can use it on the categories page as well. Maybe, if I have the time I will post the modifications tomorrow, but I can't promise that.

So stay tuned ;)

Regards,
Bash-T

//EDIT:
Here is a brief description what you have to change, if you have the Version 1.0 of my Ajax Star Rating Mod ( http://www.4homepages.de/forum/index.php?topic=25551.0 ) installed.

You can see the results on my demopage: http://www.pawlikonline.de/temp/4images/categories.php?cat_id=1
I know the css style isn't perfect, the labels will jump around, but I guess it will still fit your needs ;)

I will release a Version 1.1 with this enhancement included soon, but until then please stick to this description:


1. Open details.php
Locate and delete:
//-----------------------------------------------------
//--- [MOD] Ajax Star Rating --------------by Bash-T---
//START------------------------------------------------
$site_template->register_vars(array(
	
"ajax_rating_labels_0" => $lang['ajax_rating_labels'][0],
	
"ajax_rating_labels_1" => $lang['ajax_rating_labels'][1],
	
"ajax_rating_labels_2" => $lang['ajax_rating_labels'][2],
	
"ajax_rating_labels_3" => $lang['ajax_rating_labels'][3],
	
"ajax_rating_labels_4" => $lang['ajax_rating_labels'][4],
	
"ajax_rating_labels_5" => $lang['ajax_rating_labels'][5],
	
"ajax_rating_messages_0" => $lang['ajax_rating_messages'][0],
	
"ajax_rating_messages_1" => $lang['ajax_rating_messages'][1],
	
"ajax_rating_messages_2" => $lang['ajax_rating_messages'][2],
	
"ajax_rating_messages_3" => $lang['ajax_rating_messages'][3],
	
"ajax_rating_points" => $lang['ajax_rating_points']
));
//-----------------------------------------------------
//--- [MOD] Ajax Star Rating --------------by Bash-T---
//--------------------------------------------------END


2. Open includes/page_header.php
Locate:
?>

Insert above:
//-----------------------------------------------------
//--- [MOD] Ajax Star Rating --------------by Bash-T---
//START------------------------------------------------
$site_template->register_vars(array(
	
"ajax_rating_labels_0" => $lang['ajax_rating_labels'][0],
	
"ajax_rating_labels_1" => $lang['ajax_rating_labels'][1],
	
"ajax_rating_labels_2" => $lang['ajax_rating_labels'][2],
	
"ajax_rating_labels_3" => $lang['ajax_rating_labels'][3],
	
"ajax_rating_labels_4" => $lang['ajax_rating_labels'][4],
	
"ajax_rating_labels_5" => $lang['ajax_rating_labels'][5],
	
"ajax_rating_messages_0" => $lang['ajax_rating_messages'][0],
	
"ajax_rating_messages_1" => $lang['ajax_rating_messages'][1],
	
"ajax_rating_messages_2" => $lang['ajax_rating_messages'][2],
	
"ajax_rating_messages_3" => $lang['ajax_rating_messages'][3],
	
"ajax_rating_points" => $lang['ajax_rating_points']
));
//-----------------------------------------------------
//--- [MOD] Ajax Star Rating --------------by Bash-T---
//--------------------------------------------------END


3. Open (your_template)/details.html
Locate and delete:
Code: [Select]
<!-----------------------------------------------------
//--- [MOD] Ajax Star Rating --------------by Bash-T---
//START----------------------------------------------->
<script type="text/javascript">
YAHOO.namespace('rating');
YAHOO.rating.star={
display_percentage : false, //set to true if a percentaged value shall be shown beneath the stars.
display_lables: true, //set to true if a ranking label shall be displayed beneath the stars at mouseover.
//do not modify the properties below!
num : 0,
successfully_voted : false,
labels : [ '{ajax_rating_labels_0}' , '{ajax_rating_labels_1}', '{ajax_rating_labels_2}', '{ajax_rating_labels_3}', '{ajax_rating_labels_4}', '{ajax_rating_labels_5}'],
msgs : [ '{ajax_rating_messages_0}' , '{ajax_rating_messages_1}', '{ajax_rating_messages_2}']
};
</script>
<script type="text/javascript" src="scripts/ajaxrating.js"></script>
<!-----------------------------------------------------
//--- [MOD] Ajax Star Rating --------------by Bash-T---
//-----------------------------------------------END-->


4. Open (your_template)/header.html
Locate:
Code: [Select]
{if has_rss}
Insert above:
Code: [Select]
<!-----------------------------------------------------
//--- [MOD] Ajax Star Rating --------------by Bash-T---
//START----------------------------------------------->
<script type="text/javascript">
YAHOO.namespace('rating');
YAHOO.rating.star={
display_percentage : false, //set to true if a percentaged value shall be shown beneath the stars.
display_lables: true, //set to true if a ranking label shall be displayed beneath the stars at mouseover.
//do not modify the properties below!
num : {image_id},
successfully_voted : false,
labels : [ '{ajax_rating_labels_0}' , '{ajax_rating_labels_1}', '{ajax_rating_labels_2}', '{ajax_rating_labels_3}', '{ajax_rating_labels_4}', '{ajax_rating_labels_5}'],
msgs : [ '{ajax_rating_messages_0}' , '{ajax_rating_messages_1}', '{ajax_rating_messages_2}']
};
</script>
<script type="text/javascript" src="scripts/ajaxrating.js"></script>
<!-----------------------------------------------------
//--- [MOD] Ajax Star Rating --------------by Bash-T---
//-----------------------------------------------END-->

5. Open (youre_template)/rate_form.html
Locate:
Code: [Select]
<form method="post" id="ajax_rate_form" name="ajax_rate_form">
<div id="star"><br style="clear: both;" />
 <ul id="star0" class="star" onMouseDown="YAHOO.rating.star.update(event,this)" onMouseMove="YAHOO.rating.star.mouse(event,this)">
<li id="starCur0" class="curr" title="{image_rating}" style="width: 0px;"></li>
 </ul>
 <div style="color: rgb(136, 136, 136);" id="starUser0" class="user" percent="0"></div>
 <div id="star_rating_label" class="user"></div>
 <div id="star_rating_msg" class="user"></div>
</div>
<input type="hidden" name="rating" value="0" />
<input type="hidden" name="action" value="rateimage" />
<input type="hidden" name="id" value="{image_id}" />
</form>

replace with:
Code: [Select]
<form method="post" id="ajax_rate_form{image_id}" name="ajax_rate_form">
<div id="star"><br style="clear: both;" />
 <ul id="star{image_id}" class="star" onMouseDown="YAHOO.rating.star.update(event,this)" onMouseMove="YAHOO.rating.star.mouse(event,this)">
<li id="starCur{image_id}" class="curr" title="{image_rating}" style="width: 0px;"></li>
 </ul>
 <div style="color: rgb(136, 136, 136);" id="starUser{image_id}" class="user" percent="0"></div>
 <div id="star_rating_label{image_id}" class="user"></div>
 <div id="star_rating_msg{image_id}" class="user"></div>
</div>
<input type="hidden" name="rating" value="0" />
<input type="hidden" name="action" value="rateimage" />
<input type="hidden" name="id" value="{image_id}" />
</form>

6. Open (your_template)/thumbnail_bit.html
Insert at this place, where you want the rating element beeing shown:
Code: [Select]
<div align="center">{rate_form}</div>
<span id="ajax_rating_count{image_id}">{image_votes}</span> {lang_votes} | <span id="ajax_rating_rate{image_id}">{image_rating}</span> {ajax_rating_points}

7. Download attached ajaxrating_v1.1.zip and extract it into the /scripts/ folder (overwrite the old one)



Tweaks:
  • You can tweak the settings for the starRating Elements on each page (details.html, categories.html, index.html) by adding the following lines, directly below the {header}
Code: [Select]
<!-----------------------------------------------------
//--- [MOD] Ajax Star Rating -TWEAK-----(c)-by Bash-T--
//START----------------------------------------------->
<script language="javascript">
YAHOO.rating.star.display_percentage = false; //if true: percentages will be shown for each star element on this page
YAHOO.rating.star.display_lables = false; //if true: labels will be shown for each star element on this page
</script>
<!-----------------------------------------------------
//--- [MOD] Ajax Star Rating -TWEAK------(c)-by Bash-T-
//-----------------------------------------------END-->
    Anyway, you do not have to insert this code on each page. If nothing is specified, then the default settings from the header.html will be taken.
     [/li]

Hope this enhancement of my mod will now fit you needs :-)

Regards,
Bash-T
« Last Edit: September 06, 2009, 10:42:49 PM by bash-t »
4images Version: 1.7.7

rinaldos

  • Guest
Re: [MOD] Using Ajax Star Ratings MOD in Category Listings
« Reply #2 on: August 29, 2009, 09:58:00 AM »
@bash-t
Nur ein paar Änderungen würde ich dir empfehlen :-) Die Bewertung in Textform unter die Sterne setzen, dann wird auch das Template nicht verschoben, aber die Erweitung sieht schon sehr gut aus :-)

Offline eeyipes

  • Pre-Newbie
  • Posts: 7
    • View Profile
Re: [MOD] Using Ajax Star Ratings MOD in Category Listings
« Reply #3 on: August 30, 2009, 04:04:27 AM »
Wow! That was fast, and it works beautifully - way better than the old rating box! I'm sure others will love this too .  .  .   

Thanks so much!

Offline winracer

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • Help Me With Perl
Re: [MOD] Using Ajax Star Ratings MOD in Category Listings
« Reply #4 on: November 19, 2009, 02:34:36 PM »
I installed this mod and working. I have one problem when no one is login I have this message on the right side of the stars that says


 Some ratings are disabled for this image.


how do i stop the message  if need to view my site it at
myfunnypets.com

winracer

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] Using Ajax Star Ratings MOD in Category Listings
« Reply #5 on: November 19, 2009, 02:57:54 PM »
@winracer

... I think ... because of your changing of  'MAX_RATING'  in includes/constants.php ...
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 winracer

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • Help Me With Perl
Re: [MOD] Using Ajax Star Ratings MOD in Category Listings
« Reply #6 on: November 19, 2009, 03:10:05 PM »
@winracer

... I think ... because of your changing of  'MAX_RATING'  in includes/constants.php ...

thanks,

I changed it back to define('MAX_RATING', 5);

from

//define('MAX_RATING', 6);


and it is still doing the samething
« Last Edit: November 19, 2009, 04:17:39 PM by winracer »
winracer

Offline Bugfixed

  • Jr. Member
  • **
  • Posts: 95
    • View Profile
    • http://www.lavinya.net
Re: [MOD] Using Ajax Star Ratings MOD in Category Listings
« Reply #7 on: May 04, 2012, 05:18:32 PM »
Hello thanks for mod.
I've installed the first version of it. did not work.
After I updated the above version 1.1. still does not work.
This mode does not work in any browsers   :(

As with the mouse on the stars seem to work.
However, do not understand where you click and vote not fixed stars .. voting does not seem to have any symptoms that had been given. However, re-install as the page (f5) is understood given votes.

My system: 4images 1.7.10, Httpd 2.2.21.x, Php 5.3.10.x, mysql 5.5.23.x on centos 5.8

Please update mod. thanks.
<?php Find Bug ?>

 

Post your comments here