1. News Rating

News Rating

  |   10
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
Dear visitor, you are browsing our website as Guest.
We strongly recommend you to register and login to view hidden contents.

Details

+6

Comments 10

asaadshaikh
Commented By asaadshaikh on January 1, 2013 (2:49 am)
thanks
i will test it
3 43Forum topics : 14Forum replies : 30Forum likes : 0
GanjaMan
GanjaMan
Members
Commented By GanjaMan on January 1, 2013 (9:03 am)
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!
N/A 2Forum topics : 5Forum replies : 19Forum likes : 0
Dark22
Dark22
V.I.P.
Commented By Dark22 on January 2, 2013 (7:30 am)
I can`t see the download attached for images where is it
11 21Forum topics : 56Forum replies : 158Forum likes : 6

Waqas Ahmad
Commented By Waqas Ahmad on January 3, 2013 (8:51 am)
Dark22,
There are two little images at the end of this post. Just right click and save these two (up and down arrow) images.
1 28Forum topics : 14Forum replies : 67Forum likes : 5
seoulxd
seoulxd
Members
Commented By seoulxd on January 4, 2013 (7:10 pm)
oRiting v3 - Free download http://8dle.ru/free-modules/4890-orating-v3-by-sander.html
English version Please Please :(
N/A 10Forum topics : 0Forum replies : 1Forum likes : 0
noobos
noobos
DLE TEAM
Commented By noobos on January 4, 2013 (8:28 pm)
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...
16 302Forum topics : 12Forum replies : 1036Forum likes : 170
asaadshaikh
Commented By asaadshaikh on July 13, 2013 (6:44 am)
Thanks a lot beer2
3 43Forum topics : 14Forum replies : 30Forum likes : 0
MisterCaca
MisterCaca
Members
Commented By MisterCaca on August 1, 2013 (6:09 pm)
It works in comments?

Thanks!
N/A 18Forum topics : 25Forum replies : 86Forum likes : 1
sawanbanna
sawanbanna
DLE TEAM
Commented By sawanbanna on August 1, 2013 (10:01 pm)
MisterCaca
This is for articles and posts, not comment
31 409Forum topics : 23Forum replies : 979Forum likes : 150

« Live as if you were to die tomorrow. Learn as if you were to live forever! »
MisterCaca
MisterCaca
Members
Commented By MisterCaca on August 1, 2013 (10:20 pm)
Quote: sawanbanna
MisterCaca
This is for articles and posts, not comment

Thanks, you know any module for comments rating ?
N/A 18Forum topics : 25Forum replies : 86Forum likes : 1
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.
DLEStarter Notice!Please note...Every hack and every module will get additional queries from your database and some hacks and some modules may result your server overload, so install only what you "need", remove any hacks and modules from your script when you don't need them, all hacks and modules appears in this website are not guaranteed by DLEStarter Team for your script security and compatibility, please read instruction carefully and use hacks and modules at your own risk...Thank you.