Discuz Thai

 ลืมรหัสผ่าน
 สมัครสมาชิก

ข้อตกลงการใช้งานกระดานข่าวดิสคัสไทย DiscuzThai Agreement (English Version) ประกาศดิสคัสไทย - ทำเนียบดิสคัสภาษาไทย

Discuz! X3.5 Thai R20231001 Rev.8 (NEW) [วิดีโอช่วยสอน] อัปเกรด Discuz! X3.4 เป็น X3.5 Discord ของ Discuz! Thai Community อย่างเป็นทางการ

Discuz! X3.4 Thai R20220811 (REV.75) สิ้นสุดการสนับสนุน Discuz! X3.4 ภาษาไทยตั้งแต่วันนี้เป็นต้นไป (ขอแนะนำให้อัปเกรดเป็น X3.5 แทน)

ค้นหา
แท็กยอดนิยม: ดิสคัสภาษาไทย Discuz Thai
ดู: 2092|ตอบกลับ: 3

บอร์ดลงแล้วมีปัญหาที่TOPLISTครับแก้ให้หน่อย

[คัดลอกลิงก์]
iplus โพสต์ 2008-7-23 21:23:41 |โหมดอ่าน
คือว่าผมลง Discuz! 6.0 =>Discuz board! premod2.1 Thai มาลงบนโฮส
แล้วปัญหามันอยู่ที่ว่า ใน TOPLIST ไม่มีการแสดงอะไรเลย แม้ว่าจะโพสต์รูป และอื่นๆแล้วก็ตามมันก็ยังโล่ง อยู่เหมือนเดิมทุกช่อง
อยากทราบว่า จะแก้ยังไงครับ
นี่โค้ดในไฟล์ toplist.php
  1. <?php

  2.         //---砞竚---start
  3.                
  4.                 $shownums = 10;                                        //逼计
  5.                 $hotforumday = 15;                                //ぶぱず荐
  6.                 $subjectcut= 14;                                //夹肈陪ボ计
  7.                 $authorcut= 4;                                        //﹎计
  8.                 $cachelife = 1800;                        //酚龟悔薄猵砞竚纐粄1800.
  9.                 $cachename = 'toplist_' . $_GET['toplist_type'];                //絯.璝籔ㄤ础ン侥叫э,璶ぃ侥ぃ穦紇臫ㄏノ.

  10.         //---砞竚---end

  11.         require_once ('../include/common.inc.php');
  12.         include(DISCUZ_ROOT . 'forumdata/cache/cache_' . $cachename . '.php');
  13.         if($expiration < time()){
  14.                 switch($_GET['toplist_type']){
  15.                         case 'new':
  16.                                 $query = $db->query("select f.name,t.tid,t.subject,t.author,t.authorid,t.lastposter,t.dateline,t.views,t.replies,t.lastpost,t.lastposter
  17.                                                                                                                  from {$tablepre}threads as t, {$tablepre}forums as f
  18.                                                                                                                  where t.fid = f.fid order by dateline desc limit $shownums");
  19.                                 $lastposturl = '';
  20.                                 break;
  21.                         case 'hot':
  22.                                 $datatime = time()-($hotforumday * 24 * 60 * 60);
  23.                                 $query = $db->query("select f.name,t.tid,t.subject,t.author,t.authorid,t.lastposter,t.dateline,t.views,t.replies,t.lastpost,t.lastposter
  24.                                                                                                                  from {$tablepre}threads as t, {$tablepre}forums as f
  25.                                                                                                                  where t.fid = f.fid and dateline > $datatime order by views desc limit $shownums");
  26.                                 $lastposturl = '';
  27.                                 break;
  28.                         case 'newposts':
  29.                                 $query = $db->query("select p.author,p.authorid,f.name,t.tid,t.author as forumauthor,t.authorid as forumauthorid,t.subject,t.lastposter,t.dateline,t.views,t.replies,t.lastpost,t.lastposter
  30.                                                                                                                  from {$tablepre}threads as t, {$tablepre}posts as p, {$tablepre}forums as f
  31.                                                                                                                  where t.tid = p.tid and t.fid = f.fid and p.first = 0 order by p.dateline desc limit $shownums");
  32.                                 $lastposturl = '&goto=lastpost#lastpost';
  33.                                 break;
  34.                 }
  35.                 $num = 0;
  36.                 while($res = $db->fetch_array($query)){
  37.                         $data['foruminfo'][$num] = array(
  38.                                 'authorid' => $res['authorid'],
  39.                                 'tid' => $res['tid'],
  40.                                 'subject' => cutstr($res['subject'],$subjectcut*2,$dot='..'),
  41.                                 'subjectfull' => $res['subject'],
  42.                                 //'forumname' => $res['name'],
  43.                                 'author' => cutstr($res['author'],$authorcut*2,$dot='..'),
  44.                                 'authorfull' => $res['author'],
  45.                                 'posttime' => date('Y-m-d H:i', $res['dateline']),
  46.                                 'vw_tm' => $res['views'],
  47.                                 'replies' => $res['replies'],
  48.                                 'lastposttime' => date('Y-m-d H:i', $res['lastpost']),
  49.                                 'lastposter' => $res['lastposter'],
  50.                         );
  51.                         if($_GET['toplist_type'] == 'newposts'){
  52.                                 $data['foruminfo'][$num]['forumauthor'] = $res['forumauthor'];
  53.                                 $data['foruminfo'][$num]['forumauthorid'] = $res['forumauthorid'];
  54.                         }
  55.                 $num++;
  56.                 }
  57.                 $data['expiration'] = $cachelife + time();
  58.                 $data['cacheshownums'] = $shownums;
  59.                 require_once (DISCUZ_ROOT . 'include/cache.func.php');
  60.                 writetocache($cachename, '', getcachevars($data));
  61.                 include(DISCUZ_ROOT . 'forumdata/cache/cache_' . $cachename . '.php');
  62.         }
  63.         foreach($foruminfo as $k => $v){
  64.                 $jsstr = "document.write('<span style="margin-right:8px;float:right;"><a href="space.php?action=viewpro&uid=" . $v['authorid'] . "" style="color:#535353;">" . $v['author'] . "</a></span><span style="float:left;"><a href="viewthread.php?tid=" . $v['tid'] . $lastposturl . """;
  65.                 $jsstr .= "title="หัวข้อ: " . $v['subjectfull'] . "";
  66.                 if($_GET['toplist_type'] == 'newposts'){
  67.                         $jsstr .= " โพสโดย: " . $v['forumauthor'] . "";
  68.                 }else{
  69.                         $jsstr .= " โพสโดย: " . $v['author'] . "";
  70.                 }
  71.                 $jsstr .= " โพสเมื่อ: " . $v['posttime'] . " ดูแล้ว: " . $v['vw_tm'] . " ตอบแล้ว: " . $v['replies'] . " ตอบล่าสุดเวลา: " . $v['lastposttime'] . " ตอบล่าสุดโดย: " . $v['lastposter'] . """;
  72.                 $jsstr .= " "style="color:#535353;">" . $v['subject'] . "</a></span><br />');";
  73.                 echo $jsstr;
  74.         }

  75. ?>
คัดลอกไปที่คลิปบอร์ด
ไฟล์ usertoplist.php
  1. <?php

  2.         //---砞竚---start
  3.                
  4.                 $shownums = 10;                                        //逼计
  5.                 $authorcut= 4;                                        //﹎计
  6.                 $cachelife = 1800;                        //酚龟悔薄猵砞竚纐粄1800.
  7.                 $cachename = 'toplist_usertoplist';                //絯.璝籔ㄤ础ン侥叫э,璶ぃ侥ぃ穦紇臫ㄏノ.

  8.         //---砞竚---end

  9.         require_once ('../include/common.inc.php');
  10.         include(DISCUZ_ROOT . 'forumdata/cache/cache_' . $cachename . '.php');
  11.         if($expiration < time()){
  12.                 $datatime = time()-(24 * 60 * 60);
  13.                 $query = $db->query("select author,authorid from {$tablepre}posts where dateline > $datatime");
  14.                 $num = 0;
  15.                 while($res = $db->fetch_array($query)){
  16.                         $datatmp[$num] = $res['authorid'];
  17.                         $num++;
  18.                 }
  19.                 $datacount = array_flip(array_count_values($datatmp));
  20.                 $datarsort = krsort($datacount);
  21.                 $num = 0;
  22.                 foreach($datacount as $k => $v ){
  23.                         if($num == $shownums){
  24.                                 break;
  25.                         }
  26.                         $query = $db->query("select username from {$tablepre}members where uid = $v");
  27.                         $res = $db->fetch_array($query);
  28.                         $data['usertoplistinfo'][$num]['userid'] = $v;
  29.                         $data['usertoplistinfo'][$num]['username'] = cutstr($res['username'],$authorcut*2,$dot='..');
  30.                         $data['usertoplistinfo'][$num]['postscount'] = $k;
  31.                         $num++;
  32.                 }
  33.                 $data['expiration'] = $cachelife + time();
  34.                 require_once (DISCUZ_ROOT . 'include/cache.func.php');
  35.                 writetocache($cachename, '', getcachevars($data));
  36.                 include(DISCUZ_ROOT . 'forumdata/cache/cache_' . $cachename . '.php');
  37.         }
  38.         foreach($usertoplistinfo as $k => $v){
  39.                 $jsstr = "document.write('<a href="space.php?action=viewpro&uid=" . $v['userid'] . "" style="color:#535353;">" . $v['username'] . "</a><span style="color:#FF6D00;">[" . $v['postscount'] . "]</span><br />');";
  40.                 echo $jsstr;
  41.         }

  42. ?>
คัดลอกไปที่คลิปบอร์ด

[ แก้ไขล่าสุด iplus เมื่อ 2008-7-23 21:33 ]

ขออภัย! โพสต์นี้มีไฟล์แนบหรือรูปภาพที่ไม่ได้รับอนุญาตให้คุณเข้าถึง

คุณจำเป็นต้อง ลงชื่อเข้าใช้ เพื่อดาวน์โหลดหรือดูไฟล์แนบนี้ คุณยังไม่มีบัญชีใช่ไหม? สมัครสมาชิก

x
 เจ้าของ| iplus โพสต์ 2008-7-23 21:24:17
ไฟล์ focuspic.php
  1. <?php
  2. //---砞竚---start
  3. $shownums = 5;                                                //簍ボ计,禬筁6玥礚猭ㄏノ旧兵.
  4. $searchnums = 30;                                        //穓羆计.
  5. $cachelife = 1800;                                //酚龟悔薄猵砞竚纐粄1800.
  6. $orderby = 'dateline';                //穓抖.酚ら戳穓块dateline.酚聅凝Ω计块downloads.繦诀穓叫块rand.
  7. $cachename = 'showpic';                //絯.璝籔ㄤ础ン侥叫э,璶ぃ侥ぃ穦紇臫ㄏノ.
  8. $searchfid = '1,2,3';                                        //穓絛瞅.ぃ痙.叫ノ硆腹筳,'1,2,3'.
  9. //---砞竚---end

  10. require_once ('../include/common.inc.php');
  11. include_once (DISCUZ_ROOT . 'forumdata/cache/cache_' . $cachename . '.php');
  12. if((@!include(DISCUZ_ROOT . 'forumdata/cache/cache_'.$cachename . '.php')) || $expiration < time() || $cacheshownums != $shownums || $cachesearchnums != $searchnums || $cachecachelife != $cachelife || $cacheorderby != $orderby || $cachecachename != $cachename || $cachesearchfid != $searchfid){
  13.         $orderbytmp = $orderby != 'rand' ? 'attach.'.$orderby : 'rand()';
  14.         $fids = $searchfid ? 'AND '."t.fid IN ($searchfid)" : '';
  15.         $data = array();
  16.         $query = $db->query("SELECT attach.aid, attach.attachment, t.tid, t.fid, t.subject FROM {$tablepre}attachments attach LEFT JOIN {$tablepre}threads t ON t.displayorder>=0 AND t.tid=attach.tid WHERE attach.readperm='0' AND displayorder>='0' AND filetype LIKE 'image/%' $fids GROUP BY attach.tid ORDER BY $orderbytmp DESC LIMIT $searchnums");
  17.         $num = 0;
  18.         while ($pic = $db->fetch_array($query)) {
  19.                 $data['pic'][$num]['showpicpics'] = $attachurl.'/'.$pic['attachment'];
  20.                 $data['pic'][$num]['showpiclinks'] = "viewthread.php?tid=$pic[tid]";
  21.                 $data['pic'][$num]['showpictexts'] = str_replace('\'', '&nbsp;',$pic['subject']);
  22.                 $num++;
  23.         }
  24.         $data['expiration'] = $cachelife + time();
  25.         $data['cacheshownums'] = $shownums;
  26.         $data['cachesearchnums'] = $searchnums;
  27.         $data['cachecachelife'] = $cachelife;
  28.         $data['cacheorderby'] = $orderby;
  29.         $data['cachecachename'] = $cachename;
  30.         $data['cachesearchfid'] = $searchfid;
  31.         require_once (DISCUZ_ROOT . 'include/cache.func.php');
  32.         writetocache($cachename, '', getcachevars($data));
  33.         include(DISCUZ_ROOT . 'forumdata/cache/cache_' . $cachename . '.php');
  34. }

  35. shuffle($pic);
  36. $i = 0;
  37. $j = 0;
  38. while ($j < $shownums && isset($pic[$i])) {
  39.         if(is_readable('../' . $pic[$i]['showpicpics'])) {
  40.                 $showpicpics .= $comma.$pic[$i]['showpicpics'];
  41.                 $showpiclinks .= $comma.$pic[$i]['showpiclinks'];
  42.                 $showpictexts .= $comma.$pic[$i]['showpictexts'];
  43.                 $comma = '|';
  44.                 $j++;
  45.         }
  46.         $i++;
  47. }
  48. ?>
  49. var swf_width=240
  50. var swf_height=175
  51. var files = '<?=$showpicpics?>';
  52. var links = '<?=$showpiclinks?>';
  53. var texts = '<?=$showpictexts?>';
  54. document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ swf_width +'" height="'+ swf_height +'">');
  55. document.write('<param name="movie" value="toplist/images/focus.swf"><param name="quality" value="high">');
  56. document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
  57. document.write('<param name="FlashVars" value="bcastr_file='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'">');
  58. document.write('<embed src="toplist/images/focus.swf" wmode="opaque" FlashVars="bcastr_file='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'& menu="false" quality="high" width="'+ swf_width +'" height="'+ swf_height +'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
  59. document.write('</object>');
คัดลอกไปที่คลิปบอร์ด
ไฟล์ memberrank.php
  1. <?php
  2.         //---砞竚---start
  3.                
  4.                 $posthour = 2;                                                        //逼丁
  5.                 $cachename = 'memberrank';                        //絯.璝籔ㄤ础ン侥叫э,璶ぃ侥ぃ穦紇臫ㄏノ.
  6.                
  7.         //---砞竚---end
  8.        
  9.         $seltime = time() - (60 * 60 * $posthour);

  10.         require_once '../include/common.inc.php';

  11.         include(DISCUZ_ROOT . 'forumdata/cache/cache_' . $cachename . '.php');
  12.         if((time()-$expiration) > (60 * 60 * $posthour)){
  13.                 $query = $db->query("select authorid from {$tablepre}posts where dateline > $seltime");
  14.                 $userkey = 0;
  15.                 while($res = $db->fetch_array($query)) {
  16.                         $datatmp[$userkey] = $res['authorid'];
  17.                         $userkey++;
  18.                 }
  19.                 if(empty($datatmp)){
  20.                         for($i = 1; $i < 24; $i++){
  21.                                 $seltime = time() - (60 * 60 * ($posthour + $i));
  22.                                 $query = $db->query("select authorid from {$tablepre}posts where dateline > $seltime");
  23.                                 $userkey = 0;
  24.                                 while($res = $db->fetch_array($query)) {
  25.                                         $datatmp[$userkey] = $res['authorid'];
  26.                                         $userkey++;
  27.                                 }
  28.                                 if(!empty($datatmp)){
  29.                                         break;
  30.                                 }
  31.                         }
  32.                 }
  33.        
  34.                 $datacount = array_count_values($datatmp);
  35.                 $datamax = 1;
  36.                 foreach($datacount as $k => $v){
  37.                         if($v > $datamax){
  38.                                 $datamax = $v;
  39.                         }
  40.                 }
  41.                 foreach($datacount as $k => $v){
  42.                         if($v == $datamax){
  43.                                 $userid = $k;
  44.                         }
  45.                 }

  46.                 $query = $db->query("select count(pid) as postscount from {$tablepre}posts where authorid = $userid");
  47.                 $res = $db->fetch_array($query);
  48.        
  49.                 $userposts = $res['postscount'];
  50.                
  51.                 $query = $db->query("select stars from {$tablepre}ranks where postshigher < $userposts order by postshigher desc limit 1");
  52.                 $res = $db->fetch_array($query);
  53.                
  54.                 $userstarscount = $res['stars'];
  55.                 unset($userstars);
  56.                 for($i = 0; $i < $userstarscount; $i++){
  57.                         $userstars .= "<img src="images/Beijing2008/star_level1.gif" />";
  58.                 }
  59.                 $query = $db->query("select username,posts,digestposts,credits,oltime from {$tablepre}members where uid = $userid");
  60.                 $res = $db->fetch_array($query);
  61.                
  62.                 $username = $res['username'];
  63.                 $usermark = $res['credits'];
  64.                 $userdigest = $res['digestposts'];
  65.                 $userpostscount = $res['posts'];
  66.                 $useroltime = $res['oltime'];
  67.                
  68.                 $query = $db->query("select count(pid) as postsnow from {$tablepre}posts where dateline > $seltime and authorid = $userid");
  69.                 $res = $db->fetch_array($query);
  70.                
  71.                 $userpostsnow = $res['postsnow'];
  72.                
  73.                 $query = $db->query("select avatar,location from {$tablepre}memberfields where uid = $userid");
  74.                 $res = $db->fetch_array($query);
  75.                 if(empty($res['location']) || $res['location'] == 'share'){
  76.                         $userlocation = "既礚";
  77.                 }else{
  78.                         if(preg_match('/^([\x81-\xfe][\x40-\xfe]){0,2}$/',$res['field_1'])){
  79.                                 $userlocation = cutstr($res['field_1'],10,$dot='..');
  80.                         }else{
  81.                                 $userlocation = "既礚";
  82.                         }
  83.                 }
  84.                
  85.                 if(empty($res['avatar'])){
  86.                         $useravatar = "images/avatars/noavatar.gif";
  87.                 }else{
  88.                         $useravatar = $res['avatar'];
  89.                 }
  90.                 $imagesizetmp=GetImageSize(DISCUZ_ROOT . $useravatar);
  91.                
  92.                 if($imagesizetmp[0] > $imagesizetmp[1]){
  93.                         $imagesize = "width="110"";
  94.                 }else{
  95.                         $imagesize = "height="110"";
  96.                 }
  97.        
  98.                 $data['expiration'] = time();
  99.                 $data['userid'] = $userid;
  100.                 $data['username'] = $username;
  101.                 $data['usermark'] = $usermark;
  102.                 $data['userdigest'] = $userdigest;
  103.                 $data['userpostsnow'] = $userpostsnow;
  104.                 $data['userpostscount'] = $userpostscount;
  105.                 $data['useroltime'] = $useroltime;
  106.                 $data['userlocation'] = $userlocation;
  107.                 $data['useravatar'] = $useravatar;
  108.                 $data['imagesize'] = $imagesize;
  109.                 $data['userstars'] = $userstars;
  110.                 require_once (DISCUZ_ROOT . 'include/cache.func.php');
  111.                 writetocache($cachename, '', getcachevars($data));
  112.                 include(DISCUZ_ROOT . 'forumdata/cache/cache_' . $cachename . '.php');
  113.         }
  114.        
  115. ?>
  116. document.write('<div align="left" style="margin:6px 0px 3px 15px;">ชื่อสมาชิก&nbsp;<span class="usershow" style="color:#3758B3;"><b><a href="space.php?action=viewpro&uid='+'<?=$userid?>'+'.html">'+'<?=$username?>'+'</a></b></span><br /></div>');
  117. document.write('<div style="width:45%;height:110px;float:left;">');
  118. document.write('<div align="left" style="line-height:25px;margin-left:15px;">');
  119. document.write('เครดิต&nbsp;'+'<?=$usermark?>'+'<br />');
  120. document.write('Digest&nbsp;'+'<?=$userdigest?>'+'<br />');
  121. document.write('โพสวันนี้&nbsp;<span style="color:#FE0000;">'+'<?=$userpostsnow?>'+'</span><br />');
  122. document.write('โพสทั้งหมด&nbsp;'+'<?=$userpostscount?>'+'<br />');
  123. document.write('ออนไลน์ทั้งหมด&nbsp;'+'<?=$useroltime?>'+'<br />');
  124. <!-- document.write('มาจาก&nbsp;'+'<?=$userlocation?>'); -->
  125. document.write('</div>');
  126. document.write('</div>');
  127. document.write('<div align="center" style="width:55%;height:110px;float:left;"><img src="'+'<?=$useravatar?>'+'" '+'<?=$imagesize?>'+' style="border:2px solid #999999;margin-top:8px;" />');
  128. document.write('<div align="center" style="width:100%;margin-top:8px;">'+'<?=$userstars?>'+'</div>');
  129. document.write('</div>');
คัดลอกไปที่คลิปบอร์ด
An_ant โพสต์ 2008-7-24 09:22:57
1.อัพเดทแคชยัง ดูตามรูปของคุณพึ่งมีแค่กระทู้เดียว (ส่วนมากแล้ว เดิม ๆ มันก็จะแสดง ผมไม่ได้ใช้รุ่นนี้เลยบอกอาการตรง ๆ ไม่ถูก)
ทอปลิสมีหลายตัวให้เลือก คลิกปุ่มค้นหาูดู
2.ตรง searchfid กำหนดบอร์ดหรือยัง
 เจ้าของ| iplus โพสต์ 2008-7-24 19:50:54
ยังไงหรอครับ การกำหนดบอร์ดหนะ (พอดีมือใหม่หัดเล่นครับ)
ขออภัย! คุณไม่ได้รับสิทธิ์ในการดำเนินการในส่วนนี้ กรุณาเลือกอย่างใดอย่างหนึ่ง ลงชื่อเข้าใช้ | สมัครสมาชิก

รายละเอียดเครดิต

รายชื่อผู้กระทำผิด|Archiver|ดิสคัส ไทย Follow us: Become a fan on facebook. Follow us on Twitter.

GMT+7, 2024-6-8 18:30

Powered by Discuz! X3.4, Rev.66

Copyright © 2001-2021 Tencent Cloud. Licensed

ตอบกระทู้ ขึ้นไปด้านบน ไปที่หน้ารายการกระทู้