Rating, plaatjes gaan meer

Hulp nodig bij een modificaties of op zoek naar een MOD? Bekijk ons archief. Support wordt helaas niet meer verleend.
Forumregels

Sinds 1 januari 2009 wordt phpBB2 niet meer ondersteund.
Onderstaande informatie is verouderd en dient uitsluitend als archief.
phpBB2.0.x
Gesloten
Epox
Berichten: 549
Lid geworden op: 15 feb 2004, 19:26
Locatie: Eindhoven
Contacteer:

Rating, plaatjes gaan meer

Bericht door Epox » 24 jan 2006, 14:22

Hey, ik heb de rating mod geinstalleerd en dat werkt perfect. Nu wou ik er wat plaatjes bij, en kwam ik op de mod van luuk:

Code: Selecteer alles

###############################################
##   This MOD is an addon for the Rate Topic Mod. It shows the average in viewforum in stead of the last post information.
###############################################

#
#-----[ UPLOAD ]------------------------------------------
# Upload it to all your templates directories!
#
star_on.gif to templates/subSilver/images/star_on.gif
star_off.gif to templates/subSilver/images/star_off.gif
star_half.gif to templates/subSilver/images/star_half.gif

#
#-----[ OPEN ]------------------------------------------
#
viewforum.php

#
#-----[ FIND ]------------------------------------------
#
	'L_AUTHOR' => $lang['Author'],

#
#-----[ ADD, AFTER ]------------------------------------------
#
	'L_RATING' => $lang['Rating'],

#
#-----[ FIND ]------------------------------------------
#
		$topic_id = $topic_rowset[$i]['topic_id'];

#
#-----[ ADD, AFTER ]------------------------------------------
#
        $ratings = rating_stats($topic_id);
		if ( $ratings['number_of_rates'] == 0 )
		{
		    $rating_img = $lang['Topic_not_rated'];
		}
		else
		{
		    $rating_img = '';
			$count = 0;
			
			for($j = 0; $j < floor($ratings['average']); $j++)
			{
			    $rating_img .= '<img src="' . $images['star_on'] . '" width="15" height="15" alt="" />';
				$count++;
			}
			$rest = $ratings['average'] - floor($ratings['average']);
			
			if ( $rest < 0.25 && $rest !== 0.00 )
			{
			    $rating_img .= '<img src="' . $images['star_off'] . '" width="15" height="15" alt="" />';
				$count++;
			}
			else if ( $rest >= 0.25 && $rest < 0.75 )
			{
			    $rating_img .= '<img src="' . $images['star_half'] . '" width="15" height="15" alt="" />';
				$count++;
			}
			else if ( $rest >= 0.75 )
			{
			    $rating_img .= '<img src="' . $images['star_on'] . '" width="15" height="15" alt="" />';
				$count++;
			}
			
			$other = $board_config['rating_max'] - $count;
			for($j = 0; $j < $other; $j++)
			{
			    $rating_img .= '<img src="' . $images['star_off'] . '" width="15" height="15" alt="" />';
			}
		}

#
#-----[ FIND ]------------------------------------------
#
			'LAST_POST_IMG' => $last_post_url,

#
#-----[ ADD, AFTER ]------------------------------------------
#
			'RATING_IMG' => $rating_img,

#
#-----[ OPEN ]------------------------------------------
# Change it for all your language directories!
#
languages/lang_english/lang_rate.php

#
#-----[ FIND ]------------------------------------------
#
$lang['No_Topics_Rated'] = "No topics have been rated";

#
#-----[ ADD, BEFORE ]------------------------------------------
#
$lang['Topic_not_rated'] = "Topic isn't rated";

#
#-----[ OPEN ]------------------------------------------
# Change it for all your templates directories!
#
templates/subSilver/subSilver.cfg

#
#-----[ FIND ]------------------------------------------
#
$images['voting_graphic'][4] = "$current_template_images/voting_bar.gif";

#
#-----[ ADD, AFTER ]------------------------------------------
#
$images['star_on'] = "$current_template_images/star_on.gif";
$images['star_off'] = "$current_template_images/star_off.gif";
$images['star_half'] = "$current_template_images/star_half.gif";

#
#-----[ OPEN ]------------------------------------------
# Change it for all your templates directories!
#
templates/subSilver/viewforum_body.tpl

#
#-----[ FIND ]------------------------------------------
#
	  <th align="center" class="thCornerR" nowrap="nowrap"> {L_LASTPOST} </th>

#
#-----[ IN-LINE, FIND ]------------------------------------------
#
{L_LASTPOST}

#
#-----[ IN-LINE, REPLACE ]------------------------------------------
#
{L_RATING}

#
#-----[ FIND ]------------------------------------------
#
	  <td class="row3Right" align="center" valign="middle" nowrap="nowrap"><span class="postdetails">{topicrow.LAST_POST_TIME}<br />{topicrow.LAST_POST_AUTHOR} {topicrow.LAST_POST_IMG}</span></td>

#
#-----[ IN-LINE, FIND ]------------------------------------------
#
{topicrow.LAST_POST_TIME}<br />{topicrow.LAST_POST_AUTHOR} {topicrow.LAST_POST_IMG}

#
#-----[ IN-LINE, REPLACE ]------------------------------------------
#
{topicrow.RATING_IMG}

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
# Eom
#

Maar als ik dit uitvoer, komen er meerdere plaatjes te staan, bij een rating van 10 staan er 5 plaatjes. Hoe kan ik er slechts 1 plaatje neerzetten?
éépoks

Gebruikersavatar
Paul
Beheerder
Beheerder
Berichten: 20316
Lid geworden op: 23 okt 2003, 11:38
Locatie: Utrecht
Contacteer:

Bericht door Paul » 24 jan 2006, 14:54

Code: Selecteer alles

          $rating_img = '';
         $count = 0;
         
         for($j = 0; $j < floor($ratings['average']); $j++)
         {
             $rating_img .= '<img src="' . $images['star_on'] . '" width="15" height="15" alt="" />';
            $count++;
         }
         $rest = $ratings['average'] - floor($ratings['average']);
         
         if ( $rest < 0.25 && $rest !== 0.00 )
         {
             $rating_img .= '<img src="' . $images['star_off'] . '" width="15" height="15" alt="" />';
            $count++;
         }
         else if ( $rest >= 0.25 && $rest < 0.75 )
         {
             $rating_img .= '<img src="' . $images['star_half'] . '" width="15" height="15" alt="" />';
            $count++;
         }
         else if ( $rest >= 0.75 )
         {
             $rating_img .= '<img src="' . $images['star_on'] . '" width="15" height="15" alt="" />';
            $count++;
         }
         
         $other = $board_config['rating_max'] - $count;
         for($j = 0; $j < $other; $j++)
         {
             $rating_img .= '<img src="' . $images['star_off'] . '" width="15" height="15" alt="" />';
         } 
Dat stuk moet je dan aanpassen ;)

Epox
Berichten: 549
Lid geworden op: 15 feb 2004, 19:26
Locatie: Eindhoven
Contacteer:

Bericht door Epox » 24 jan 2006, 16:26

Waarin? :P
éépoks

Nymphy
Berichten: 1504
Lid geworden op: 28 mar 2003, 18:00
Locatie: Grevenbicht

Bericht door Nymphy » 25 jan 2006, 04:20

in viewforum.php ;)

Gebruikersavatar
-=|Rik|=-
Berichten: 815
Lid geworden op: 02 jan 2004, 19:49
Locatie: Eindhoven

Bericht door -=|Rik|=- » 25 jan 2006, 08:56

Epox schreef:Waarin? :P
Ligt eraan wat je wilt.
Je wil dus 1 ster? Maar bij wat voor rating moet deze "actief" worden?
-=|Rik|=- kan schadelijk zijn voor de gezondheid.
Krijg toch allemaal de kolere, val voor mijn part allemaal dood.

Gesloten