帖子列表頁顯示評分詳細+威望+金錢

Home Home
引用 | 編輯 香吉士
2009-09-27 08:41
樓主
推文 x0
【插件資訊】

插件名稱:帖子列表頁顯示評分詳細+威望+金錢
適用版本:7.0
語言編碼:通用
插件作者:不明
版權所屬:不明
原帖連結:http://www.alan888.com/Discuz/viewthread.php?tid=174940&pid=1414156&page=1&extra=page%3D2
支持網站:http://allen.ncc.to/index.php

【插件說明】

示範: 主題xxxxxxxxxxxxx [金錢+100][威望+20]





forumdisplay.php


複製程式
if(($start_limit && $start_limit > $stickycount) || !$stickycount || $filterbool) { 
$querysticky = ''; 
$query = $sdb->query("SELECT t.* FROM {$tablepre}threads t 
WHERE t.fid='$fid' $filteradd AND $displayorderadd 
ORDER BY t.displayorder DESC, t.$orderby $ascdesc 
LIMIT ".($filterbool ? $start_limit : $start_limit - $stickycount).", $tpp"); 
} else { 
$querysticky = $sdb->query("SELECT t.* FROM {$tablepre}threads t 
WHERE t.tid IN ($stickytids) AND t.displayorder IN (2, 3) 
ORDER BY displayorder DESC, $orderby $ascdesc 
LIMIT $start_limit, ".($stickycount - $start_limit < $tpp ? $stickycount - $start_limit : $tpp)); 
if($tpp - $stickycount + $start_limit > 0) { 
$query = $sdb->query("SELECT t.* FROM {$tablepre}threads t 
WHERE t.fid='$fid' $filteradd AND $displayorderadd 
ORDER BY displayorder DESC, $orderby $ascdesc 
LIMIT ".($tpp - $stickycount + $start_limit)); 
} else { 
$query = ''; 
} 

}


替換成
複製程式
if(($start_limit && $start_limit > $stickycount) || !$stickycount || $filterbool) { 
$querysticky = ''; 
$query = $sdb->query("SELECT t.*, p.rate, p.pid FROM {$tablepre}threads t 
LEFT JOIN {$tablepre}posts p USING(tid, dateline) 
WHERE t.fid='$fid' $filteradd AND $displayorderadd 
ORDER BY t.displayorder DESC, t.$orderby $ascdesc 
LIMIT ".($filterbool ? $start_limit : $start_limit - $stickycount).", $tpp"); 
} else { 
$querysticky = $sdb->query("SELECT t.*, p.rate,p.pid FROM {$tablepre}threads t 
LEFT JOIN {$tablepre}posts p USING(tid, dateline) 
WHERE t.tid IN ($stickytids) AND t.displayorder IN (2, 3) 
ORDER BY displayorder DESC, $orderby $ascdesc 
LIMIT $start_limit, ".($stickycount - $start_limit < $tpp ? $stickycount - $start_limit : $tpp)); 
if($tpp - $stickycount + $start_limit > 0) { 
$query = $sdb->query("SELECT t.*, p.rate,p.pid FROM {$tablepre}threads t 
LEFT JOIN {$tablepre}posts p USING(tid, dateline) 
WHERE t.fid='$fid' $filteradd AND $displayorderadd 
ORDER BY displayorder DESC, $orderby $ascdesc 
LIMIT ".($tpp - $stickycount + $start_limit)); 
} else { 
$query = ''; 
} 

}


繼續查找 :
複製程式
$threadlist[] = $thread;

下面加一行:
複製程式
$tpids[] = $thread['pid'];


繼續查找 :
複製程式
$separatepos = $separatepos ? $separatepos + 1 : ($announcement ? 1 : 0);


上面加上:
複製程式
if (is_array($tpids) && count($tpids)>0){ 
$tpids = array_filter($tpids,create_function('$_','return is_numeric($_);')); 
@$pids = implode(",",$tpids); 
if ($pids) { 
@$detail_query = $sdb->query("SELECT * FROM {$tablepre}ratelog WHERE pid IN ($pids)"); 
if ($detail_query){ 
while ($row = $sdb->fetch_array($detail_query)){ 
$detail_rate[$row['pid']][$row['extcredits']] += $row['score']; 
} 

} else { 
$detail_rate = array(); 
} 

} 


}


templates/default/forumdisplay.htm
查找:
複製程式
 <!--{if $thread['rate'] > 0}--> 

<img src="{IM無法使用之字串R}/agree.gif" alt="{lang rate_credit_add}" title="{lang rate_credit_add}" /> 

<!--{elseif $thread['rate'] < 0}--> 

<img src="{IM無法使用之字串R}/disagree.gif" alt="{lang rate_credit_reduce}" title="{lang rate_credit_reduce}" /> 

<!--{/if}-->

改為:
複製程式
 <!--{if $thread['rate']}--> 
<!--{loop $detail_rate[$thread[pid]] $k $v}--> 
[<font color=red> $extcredits[$k][title] 
<!--{eval echo sprintf("%+d",$v);}--> </font>] 
<!--{/loop}--> 
<!--{/if}-->

更新緩存。

這樣,評分的詳細會顯示在列表右邊,如果你不想顯示詳細的評分,只想顯示「[+多少分]」這樣的,則將這段代碼刪除即可!
再查找:
複製程式
<li class="wide"><a href="viewthread.php?tid=$tid" $thread['subjectstyles'] target="_blank">$thread[subject]</a><cite>-<a href="space.php?uid=$thread[authorid]" target="_blank">$thread[author]</a></cite></li>

替換成:
複製程式
<li class="wide"><a href="viewthread.php?tid=$tid" $thread['subjectstyles'] target="_blank">$thread[subject]</a> <!--{if $thread['rate'] > 0}-->[<b><font color=red>+$thread['rate']</font></b>]<!--{elseif $thread['rate'] < 0}-->[<b><font color=red>$thread['rate']</font></b>]<!--{/if}--> 

<cite>-<a href="space.php?uid=$thread[authorid]" target="_blank">$thread[author]</a></cite></li>


獻花 x0
引用 | 編輯 jackychanyc
2009-11-01 02:15
1樓
  
多謝~~~~

獻花 x0
引用 | 編輯 asdlkj123852
2012-04-26 12:37
2樓
  
看起來很適合用積分論壇謝謝大大分享

獻花 x0