演示效果图:
说明:这是6.0版使用过的,测试支持6.1
修改档案: forumdisplay.php
修改模版: forumdisplay.htm
一、修改 forumdisplay.php
查找:
- $querysticky = '';
- $query = $db->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 = $db->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 = $db->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 = '';
复制代码 替换为
- $querysticky = '';
- $query = $db->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 = $db->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 = $db->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 = '';
复制代码
查找:
在下一行加:
- $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 = $db->query("SELECT * FROM {$tablepre}ratelog WHERE pid IN ($pids)");
- if ($detail_query){
- while ($row = $db->fetch_array($detail_query)){
- $detail_rate[$row['pid']][$row['extcredits']] += $row['score'];
- }
- } else {
- $detail_rate = array();
- }
- }
- }
复制代码
二、修改forumdisplay.htm
查找:- <!--{if $thread['rate'] > 0}-->
- <img src="{IMGDIR}/agree.gif" alt="" />
- <!--{elseif $thread['rate'] < 0}-->
- <img src="{IMGDIR}/disagree.gif" alt="" />
- <!--{/if}-->
复制代码 替换为:
- <!--{if $thread['rate']}-->
- <!--{loop $detail_rate[$thread[pid]] $k $v}-->
- [<font color=#00FF00> $extcredits[$k][title]
- <!--{eval echo sprintf("%+d",$v);}--> </font>]
- <!--{/loop}-->
- <!--{/if}-->
复制代码
更新缓存,搞定! |