Datalife Engine 14.0
- Temalara yeni taglar eklendi ve geliştirildi
- Yeni AirPlay medya oynatıcısı eklendi
- 1500 adet yeni ifade (emoji) eklendi
Rating Sistemi
Kendi Web Sitem 'de Kuruludur. Çalışma Sistemine Bakabilirsiniz.
Kurulum Hakkında Bilgi:
1. Adım
voting.png 'i dleimages Dosyasına Yükleyin.
2. Adım 'da CSS Kodu Ekliyoruz.
İlk Olarak, Temanız 'da Bulunan engine.css Dosyasının En Altına Ekleyin.
/*---Discuz! Rating Css---*/
#ratig-layer {
font-family: Tahoma,Geneva,sans-serif;font-size:7.5pt;line-height:1.75em;
font-weight: bold;
padding-right: 5px;}
#ratig-layer a, #ratig-layer a:hover {text-decoration: none;}
.positive { color: #fff; padding:0 6px;
background: url("../dleimages/voting.png") no-repeat; background-position:0 -28px;
height: 28px; line-height: 26px;display: block;float: left;
}
.negative { color: #fff; padding:0 8px;
background: url("../dleimages/voting.png") no-repeat; background-position:0 -56px;
height: 28px; line-height: 26px;display: block;float: left;
}
.noll { color: #fff; padding:0 10px;
background: url("../dleimages/voting.png") no-repeat; background-position:0 -84px;
height: 28px; line-height: 26px;display: block;float: left;
}
.plus {
width: 27px; height: 28px; float: left; display: block;
background: url("../dleimages/voting.png") no-repeat; background-position: -344px 0;
}
.plus:hover {
background-position: -344px -28px;
}
.minus {
width: 27px; height: 28px; float: left; display: block;
background: url("../dleimages/voting.png") no-repeat; background-position: -371px 0;
}
.minus:hover {
background-position: -371px -28px;
}
3. Aç: engine/ajax/rating.php
Bul:
if( $go_rate > 5 or $go_rate < 1 ) $go_rate = 0;
Değiştir:
if( $go_rate > 5 or $go_rate < -1 ) $go_rate = 0;
4. Aç: engine/modules/functions.php
Bul:
function ShowRating($id, $rating, $vote_num, $allow = true) {
global $lang;
if( $rating ) $rating = round( ($rating / $vote_num), 0 );
else $rating = 0;
$rating = $rating * 17;
if( ! $allow ) {
$rated = <<<HTML
<div class="rating" style="float:left;">
<ul class="unit-rating">
<li class="current-rating" style="width:{$rating}px;">{$rating}</li>
</ul>
</div><div class="rating" style="float:left; padding-top:2px;"> ({$lang['voten']} {$vote_num})</div>
HTML;
return $rated;
}
$rated .= <<<HTML
<div id='ratig-layer'><div class="rating" style="float:left;">
<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 class="rating" style="float:left; padding-top:2px;"> ({$lang['voten']} {$vote_num})</div></div>
HTML;
return $rated;
}
function ShortRating($id, $rating, $vote_num, $allow = true) {
global $lang;
if( $rating ) $rating = round( ($rating / $vote_num), 0 );
else $rating = 0;
$rating = $rating * 17;
if( ! $allow ) {
$rated = <<<HTML
<div class="rating" style="float:left;">
<ul class="unit-rating">
<li class="current-rating" style="width:{$rating}px;">{$rating}</li>
</ul>
</div>
HTML;
return $rated;
}
$rated = "<div id='ratig-layer-" . $id . "'>";
$rated .= <<<HTML
<div class="rating" style="float:left;">
<ul class="unit-rating">
<li class="current-rating" style="width:{$rating}px;">{$rating}</li>
<li><a href="#" title="{$lang['useless']}" class="r1-unit" onclick="dleRate('1', '{$id}'); return false;">1</a></li>
<li><a href="#" title="{$lang['poor']}" class="r2-unit" onclick="dleRate('2', '{$id}'); return false;">2</a></li>
<li><a href="#" title="{$lang['fair']}" class="r3-unit" onclick="dleRate('3', '{$id}'); return false;">3</a></li>
<li><a href="#" title="{$lang['good']}" class="r4-unit" onclick="dleRate('4', '{$id}'); return false;">4</a></li>
<li><a href="#" title="{$lang['excellent']}" class="r5-unit" onclick="dleRate('5', '{$id}'); return false;">5</a></li>
</ul>
</div>
HTML;
$rated .= "</div>";
return $rated;
}
function userrating($name) {
global $db;
$row = $db->super_query( "SELECT SUM(rating) as rating, SUM(vote_num) as num FROM " . PREFIX . "_post where autor ='$name'" );
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;
}
Değiştir:
function ShowRating($id, $rating, $vote_num, $allow = true) {
global $is_logged, $member_id, $config, $lang, $db;
if ($rating) $rating = round($rating, 0); else $rating = 0;
switch($rating) {
case ($rating >= 0):
$rating = '<span class="positive">+'.$rating.'</span>';
break;
case ($rating <= 0):
$rating = '<span class="negative">'.$rating.'</span>';
break;
case($rating = 0):
$rating = '<span class="noll">'.$rating.'</span>';
break;
}
if (!$allow) {
$rated = <<<HTML
<div id="ratig-layer">
{$rating}
<a href="#" title="+1 Oy Ver" alt="+1 Oy Ver" class="plus" onclick="doRate('1', '{$id}'); return false;">
</a>
<a href="#" title="-1 Oy Ver" alt="-1 Oy Ver" class="minus" onclick="doRate('-1', '{$id}'); return false;">
</a>
</div>
HTML;
return $rated;
}
$rated .= <<<HTML
<span id="ratig-layer-{$id}">
<div id="ratig-layer">
{$rating}
<a href="#" title="+1 Oy Ver" alt="+1 Oy Ver" class="plus" onclick="doRate('1', '{$id}'); return false;">
</a>
<a href="#" title="-1 Oy Ver" alt="-1 Oy Ver" class="minus" onclick="doRate('-1', '{$id}'); return false;">
</a>
</div>
</span>
HTML;
return $rated;
}
function ShortRating($id, $rating, $vote_num, $allow = true) {
global $config, $lang;
if ($rating) $rating = round($rating, 0); else $rating = 0;
switch($rating) {
case ($rating >= 0):
$rating = '<span class="positive">+'.$rating.'</span>';
break;
case ($rating <= 0):
$rating = '<span class="negative">'.$rating.'</span>';
break;
case($rating = 0):
$rating = '<span class="noll">'.$rating.'</span>';
break;
}
if (!$allow) {
$rated = <<<HTML
<div id="ratig-layer">
{$rating}
<a href="#" title="+1 Oy Ver" alt="+1 Oy Ver" class="plus" onclick="doRate('1', '{$id}'); return false;">
</a>
<a href="#" title="-1 Oy Ver" alt="-1 Oy Ver" class="minus" onclick="doRate('-1', '{$id}'); return false;">
</a>
</div>
HTML;
return $rated;
}
$rated = "<span id=\"ratig-layer-" . $id . "\">";
$rated .= <<<HTML
<div id="ratig-layer">
{$rating}
<a href="#" title="+1 Oy Ver" alt="+1 Oy Ver" class="plus" onclick="dleRate('1', '{$id}'); return false;">
</a>
<a href="#" title="-1 Oy Ver" alt="-1 Oy Ver" class="minus" onclick="dleRate('-1', '{$id}'); return false;">
</a>
</div>
HTML;
$rated .= "</span>";
return $rated;
}
Rating Gözükmesi İstediğiniz Yere : {rating} Kodunu Eklemeniz Yeterli 'dir.
İşlem Sonrası Yönetim Paneli 'nden Çerezleri Silmeyi Unutmayın.
Makaleyi düzenleyen: MaRZoCHi - 24-09-2014, 02:36
Bilgilendirme
Yorum Ekleyebilmeniz için Sitemize Kayıt Olmanız Gerekmektedir.