Discuz教程网

[代码修改] 主题列表显示详细评分数量 For Discuz 6.1~7.2

[复制链接]
authicon dly 发表于 2011-11-5 09:07:54 | 显示全部楼层 |阅读模式
演示效果图:
1314学习网_Discuz图片45.png
说明:这是6.0版使用过的,测试支持6.1

修改档案: forumdisplay.php
修改模版: forumdisplay.htm

一、修改 forumdisplay.php

查找:
  1. $querysticky = '';
  2. $query = $db->query("SELECT t.* FROM {$tablepre}threads t
  3. WHERE t.fid='$fid' $filteradd AND $displayorderadd
  4. ORDER BY t.displayorder DESC, t.$orderby $ascdesc
  5. LIMIT ".($filterbool ? $start_limit : $start_limit - $stickycount).", $tpp");
  6. } else {
  7. $querysticky = $db->query("SELECT t.* FROM {$tablepre}threads t
  8. WHERE t.tid IN ($stickytids) AND t.displayorder IN (2, 3)
  9. ORDER BY displayorder DESC, $orderby $ascdesc
  10. LIMIT $start_limit, ".($stickycount - $start_limit < $tpp ? $stickycount - $start_limit : $tpp));
  11. if($tpp - $stickycount + $start_limit > 0) {
  12. $query = $db->query("SELECT t.* FROM {$tablepre}threads t
  13. WHERE t.fid='$fid' $filteradd AND $displayorderadd
  14. ORDER BY displayorder DESC, $orderby $ascdesc
  15. LIMIT ".($tpp - $stickycount + $start_limit));
  16. } else {
  17. $query = '';
复制代码
替换为
  1. $querysticky = '';
  2. $query = $db->query("SELECT t.*, p.rate, p.pid FROM {$tablepre}threads t
  3. LEFT JOIN {$tablepre}posts p USING(tid, dateline)
  4. WHERE t.fid='$fid' $filteradd AND $displayorderadd
  5. ORDER BY t.displayorder DESC, t.$orderby $ascdesc
  6. LIMIT ".($filterbool ? $start_limit : $start_limit - $stickycount).", $tpp");

  7. } else {

  8. $querysticky = $db->query("SELECT t.*, p.rate,p.pid FROM {$tablepre}threads t
  9. LEFT JOIN {$tablepre}posts p USING(tid, dateline)
  10. WHERE t.tid IN ($stickytids) AND t.displayorder IN (2, 3)
  11. ORDER BY displayorder DESC, $orderby $ascdesc
  12. LIMIT $start_limit, ".($stickycount - $start_limit < $tpp ? $stickycount - $start_limit : $tpp));

  13. if($tpp - $stickycount + $start_limit > 0) {
  14. $query = $db->query("SELECT t.*, p.rate,p.pid FROM {$tablepre}threads t
  15. LEFT JOIN {$tablepre}posts p USING(tid, dateline)
  16. WHERE t.fid='$fid' $filteradd AND $displayorderadd
  17. ORDER BY displayorder DESC, $orderby $ascdesc
  18. LIMIT ".($tpp - $stickycount + $start_limit));
  19. } else {
  20. $query = '';
复制代码

查找:
  1. $threadlist[] = $thread;
复制代码

在下一行加:
  1. $tpids[] = $thread['pid'];
复制代码
查找:
  1. $separatepos = $separatepos ? $separatepos + 1 : ($announcement ? 1 : 0);
复制代码

上面增加:
  1. if (is_array($tpids) && count($tpids)>0){
  2. $tpids = array_filter($tpids,create_function('$_','return is_numeric($_);'));
  3. @$pids = implode(",",$tpids);
  4. if ($pids) {
  5. @$detail_query = $db->query("SELECT * FROM {$tablepre}ratelog WHERE pid IN ($pids)");
  6. if ($detail_query){
  7. while ($row = $db->fetch_array($detail_query)){
  8. $detail_rate[$row['pid']][$row['extcredits']] += $row['score'];
  9. }
  10. } else {
  11. $detail_rate = array();
  12. }
  13. }
  14. }
复制代码

二、修改forumdisplay.htm
查找:
  1. <!--{if $thread['rate'] > 0}-->
  2. <img src="{IMGDIR}/agree.gif" alt="" />
  3. <!--{elseif $thread['rate'] < 0}-->
  4. <img src="{IMGDIR}/disagree.gif" alt="" />
  5. <!--{/if}-->
复制代码
替换为:

  1. <!--{if $thread['rate']}-->
  2. <!--{loop $detail_rate[$thread[pid]] $k $v}-->
  3. [<font color=#00FF00> $extcredits[$k][title]
  4. <!--{eval echo sprintf("%+d",$v);}--> </font>]
  5. <!--{/loop}-->
  6. <!--{/if}-->
复制代码

更新缓存,搞定!



上一篇:首页在线列表处,让当用户组数量过多的排列更加整齐 For Discuz 7.x
下一篇:后台文件在线管理 For Discuz 7.2
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1314学习网 ( 浙ICP备10214163号 )

GMT+8, 2025-5-2 11:04

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表