Members Login

 Do not remember me!
Not yet member? Register | Forgot Password?

News Rating

News Rating

1. Download the attached images and upload to /templates / your theme / dleimages

2. Open the file: /engine/ajax/rating.php
Find:
if ($go_rate > 5 or $go_rate <  1) $go_rate = 0;

Replace with:
if ($go_rate > 1 OR $go_rate < -1) $go_rate = 0;


3. Open the file /engine/modules/functions.php
Find:
function ShowRating($id, $rating, $vote_num, $allow = true) {
	global $lang;
	
	if( $rating AND $vote_num ) $rating = round( ($rating / $vote_num), 0 );
	else $rating = 0;
	$rating = $rating * 17;
	
	if( !$allow ) {
		
		$rated = <<<HTML
<div class="rating">
		<ul class="unit-rating">
		<li class="current-rating" style="width:{$rating}px;">{$rating}</li>
		</ul>
</div>
HTML;
		
		return $rated;
	}
	
	$rated = <<<HTML
<div id='ratig-layer-{$id}'><div class="rating">
		<ul class="unit-rating">
		<li class="current-rating" style="width:{$rating}px;">{$rating}</li>
		<li><a href="#" title="{$lang['useless']}" class="r1-unit" onclick="doRate('1', '{$id}'); return false;">1</a></li>
		<li><a href="#" title="{$lang['poor']}" class="r2-unit" onclick="doRate('2', '{$id}'); return false;">2</a></li>
		<li><a href="#" title="{$lang['fair']}" class="r3-unit" onclick="doRate('3', '{$id}'); return false;">3</a></li>
		<li><a href="#" title="{$lang['good']}" class="r4-unit" onclick="doRate('4', '{$id}'); return false;">4</a></li>
		<li><a href="#" title="{$lang['excellent']}" class="r5-unit" onclick="doRate('5', '{$id}'); return false;">5</a></li>
		</ul>
</div></div>
HTML;
	
	return $rated;
}

function userrating($id) {
	global $db;
	
	$row = $db->super_query( "SELECT SUM(rating) as rating, SUM(vote_num) as num FROM " . PREFIX . "_post_extras WHERE user_id ='{$id}'" );
	
	if( $row['num'] ) $rating = round( ($row['rating'] / $row['num']), 0 );
	else $rating = 0;

	$rating = $rating * 17;
	
	$rated = <<<HTML
<div class="rating" style="display:inline;">
		<ul class="unit-rating">
		<li class="current-rating" style="width:{$rating}px;">{$rating}</li>
		</ul>
		</div>
HTML;
	
	return $rated;
}

Replace with:
function ShowRating($id, $rating, $vote_num, $allow = true) {
 global $is_logged, $member_id, $config, $lang, $db;
if ($rating=='null'){$rating="You have already voted!";}else{
 if ($rating) $rating = round($rating, 0); else $rating = 0;
if ($rating > 0) $rating = "<font color=\"#228b22\"><b>+".$rating."</b></font>"; elseif ($rating == 0) $rating="<b>".$rating."</b>"; else $rating = "<font color=\"#ff0000\"><b>".$rating."</b></font>";
}
 if (!$allow) {
  $rated = <<<HTML
{$rating}
HTML;

 return $rated;
}

$rated .= <<<HTML
<span id="ratig-layer-{$id}">
<img src="{THEME}/dleimages/up.gif" title="I like it(+1)" alt="I like it(+1)" class="rate_img" onclick="doRate('1', '{$id}'); return false;" width="16" height="16" />&nbsp;{$rating}&nbsp;<img src="{THEME}/dleimages/down.gif" title="I do not like(-1)" alt="I do not like(-1)" class="rate_img" onclick="doRate('-1', '{$id}'); return false;" width="16" height="16" />
</span>
HTML;

 return $rated;
}

function ShortRating($id, $rating, $vote_num, $allow = true) {
 global $config, $lang;

 if ($rating) $rating = round($rating, 0); else $rating = 0;
if ($rating > 0) $rating = "<font color=\"#228b22\"><b>+".$rating."</b></font>"; elseif ($rating == 0) $rating="<b>".$rating."</b>"; else $rating = "<font color=\"#ff0000\"><b>".$rating."</b></font>";

 if (!$allow) {
  $rated = <<<HTML
{$rating}
HTML;

 return $rated;
}

$rated = "<span id=\"ratig-layer-" . $id . "\">";
$rated .= <<<HTML
<img src="{THEME}/dleimages/up.gif" title="I like it(+1)" alt="I like it(+1)" class="rate_img" onclick="doRate('1', '{$id}'); return false;" width="16" height="16" />&nbsp;{$rating}&nbsp;<img src="{THEME}/dleimages/down.gif" title="I do not like(-1)" alt="I do not like(-1)" class="rate_img" onclick="doRate('-1', '{$id}'); return false;" width="16" height="16" />
HTML;
        
 $rated  .= "</span>";

 return $rated;
}

function userrating($name) {
 global $db;

 $row = $db->super_query( "SELECT SUM(rating) as rating, SUM(vote_num) as num FROM " . PREFIX . "_post_extras WHERE user_id ='{$id}'" );

 if ($row['num']) $rating = round(($row['rating'] /  $row['num']), 0); else $rating = 0;
 $rating = $rating;

 $rated = <<<HTML
 {$rating}
HTML;

 return $rated;
}


4. Open /templates/your template/css/engine.css
Find:
.rating {

		color: #666666;
		font-family: Tahoma, helvetica, sans-serif;
		font-size: 11px; 
		height: 17px;
		float:left;
		
	}
	.unit-rating{
		list-style:none;
		margin: 0px;
		padding:0px;
		width: 85px;
		height: 17px;
		position: relative;
		background: url('../dleimages/rating.png')  left top;		
	}
	
	.unit-rating li{
	    text-indent: -90000px;
		padding:0px;
		margin:0px;
		float: left;
	}
	.unit-rating li a{
		display:block;
		width:17px;
		height: 17px;
		text-decoration: none;
		text-indent: -9000px;
		z-index: 17;
		position: absolute;
		padding: 0px;
	}
	.unit-rating li a:hover{
		background: url('../dleimages/rating.png') center left;
		z-index: 2;
		left: 0px;
	}
	.unit-rating a.r1-unit{left: 0px;}
	.unit-rating a.r1-unit:hover{width:17px;}
	.unit-rating a.r2-unit{left:17px;}
	.unit-rating a.r2-unit:hover{width: 34px;}
	.unit-rating a.r3-unit{left: 34px;}
	.unit-rating a.r3-unit:hover{width: 51px;}
	.unit-rating a.r4-unit{left: 51px;}	
	.unit-rating a.r4-unit:hover{width: 68px;}
	.unit-rating a.r5-unit{left: 68px;}
	.unit-rating a.r5-unit:hover{width: 85px;}
	.unit-rating li.current-rating{
	    
		background: url('../dleimages/rating.png') bottom left;
		position: absolute;
		height: 17px;
		display: block;
		text-indent: -9000px;
		z-index: 1;
		
}

Replace with:
.rate_img {
vertical-align: middle;
cursor: pointer;
}

Thats it....:)

News Rating
News Rating

CommentsComments (6)

asaadshaikhJanuary 1, 2013 (2:49 am) 1 Comments

{logn}
thanks
i will test it
Registered: 1.12.2012 | Group: Members | Posts: 2 | Comments: 34

GanjaManJanuary 1, 2013 (9:03 am) 2 Comments

{logn}
Wow, I have been waiting so long for a rating system like this! It is based on Sandlers mod? I tried installing his russian ilike mod (v3), hoping I'd be able to translate it to English, but something went wrong and I had to reverse it all.

Too bad I'm still using DLE 9.3.. Is there no way for me to make it work without upgrading?

Anyway, thank you so much for sharing this!
Registered: 18.12.2011 | Group: Members | Posts: 0 | Comments: 2

Dark22January 2, 2013 (7:30 am) 3 Comments

{logn}
I can`t see the download attached for images where is it
Registered: 24.10.2012 | Group: V.I.P. | Posts: 9 | Comments: 10

Waqas AhmadJanuary 3, 2013 (8:51 am) 4 Comments

{logn}
Dark22,
There are two little images at the end of this post. Just right click and save these two (up and down arrow) images.
Registered: 16.02.2012 | Group: V.I.P. | Posts: 1 | Comments: 29

seoulxdJanuary 4, 2013 (7:10 pm) 5 Comments

{logn}
oRiting v3 - Free download http://8dle.ru/free-modules/4890-orating-v3-by-sander.html
English version Please Please :(
Registered: 9.11.2011 | Group: Members | Posts: 0 | Comments: 9

noobosJanuary 4, 2013 (8:28 pm) 6 Comments

{logn}
the module is shared to public illegally but the module itself still commercial version, so we can't post it to public unless authorized by author, if you want free one you have to translate it yourself DLEStarter will not be held responsible for any illegal downloads and quite frankly the module is new to free download community until it;s well known then we will make it public like DLE nulled versions...

Sorry...
Registered: 18.10.2011 | Group: DLE TEAM | Posts: 11 | Comments: 232
Information!Would you like to leave your comment? Please Login to your account to leave comments. Don't have an account? You can create a free account now.
TOP