konggang โพสต์ 2010-5-5 16:20:22

Mod หน้าหลักแสดงกระทู้ล่าสุด 5 อันดับ ++!

แก้ไขล่าสุดโดย konggang เมื่อ 2010-5-10 14:20

อ้างอิงจากกระทู้นี้ครับ
http://www.discuzthai.com/thread-13679-1-1.html

ผมได้แก้ภาษานิดหน่อย



เปิดไฟล์include/index_classics.inc.php ค้นหา$newthreads = round(($timestamp - $lastvisit + 600) / 1000) * 1000;เพิ่มลงบรรทัดต่อไป//Post call the beginning
$hack_cut_str =60; // Modify the title here, the length of
$fids = array();
if (file_exists("./forumdata/cache/cache_forums.php")){
      require_once "./forumdata/cache/cache_forums.php";
      if (is_array($_DCACHE['forums'])){
               foreach ($_DCACHE['forums'] as $k => $v){
                        if (!strstr(',sub,forum,',','.$v['type'].',')) continue;
                        $fids[$k] = 5; // Here is the first call at the number of articles behind the needs and the same settings.
                }
      }
}
if (count($fids) < 1){
      $query = $db->query("SELECT fid FROM {$tablepre}forums WHERE type='forum' OR type='sub'");
      while ($row = $db->fetch_array($query)){
                $fids[$row['fid']] = 5; // Here is the second call at the number of needs and the same as the previous settings.
      }
}
$limit_counts = 0;
foreach ($fids as $k => $v){
      $sql .= "(SELECT t.*, f.name FROM {$tablepre}threads t LEFT JOIN {$tablepre}forums f ON f.fid = t.fid WHERE t.fid='$k' ORDER BY t.dateline DESC LIMIT $v) UNION ";
}
if ($sql){
      $sql = substr($sql,0,strlen($sql)-6);
}
$query = $db->query($sql);
while ($row = $db->fetch_array($query)){
      $row['view_subject'] = cutstr($row['subject'],$hack_cut_str);
      $row['date']= gmdate("$dateformat", $row['dateline'] + $timeoffset * 3600);
      if($row['highlight']) {
                        $string = sprintf('%02d', $row['highlight']);
                        $stylestr = sprintf('%03b', $string);
                        $row['highlight'] = 'style="';
                        $row['highlight'] .= $stylestr ? 'font-weight: bold;' : '';
                        $row['highlight'] .= $stylestr ? 'font-style: italic;' : '';
                        $row['highlight'] .= $stylestr ? 'text-decoration: underline;' : '';
                        $row['highlight'] .= $string ? 'color: '.$colorarray[$string] : '';
                        $row['highlight'] .= '"';
      } else {
                        $row['highlight'] = '';
      }
      ${'new_no'.$row['fid'].'_threadlist'}[] = $row;
}
//Call the end of the postเปิดไฟล์ templates/default/css_common.htm ค้นหา.list th { background: url({IMGDIR}/forum.gif) 5px 10px no-repeat; padding-left: 45px !important; }เปลี่ยนเป็น.list th { background: url({IMGDIR}/forum.gif) 3px 17px no-repeat; padding-left: 15px !important; }เปิดไฟล์ templates/default/discuz.htm ค้นหา<tbody id="forum$forum">
จนถึง
$cat['endrows']เปลี่ยนเป็น<tbody id="forum$forum">
<tr>
<td>
$forum
<div class="left">
<h2><a href="forumdisplay.php?fid=$forum" {if $forum}target="_blank" {/if}>$forum</a> <font class="smalltext"><!--{if $forum}-->T: <font color="#FF3399">$forum</font><img src="{IMGDIR}/new.gif" align="absmiddle"><!--{else}-->T: <font color="#FF3399">0</font><!--{/if}--> P: <font color="#00CCFF">$forum</font> R: <font color="#99CC00">$forum</font></font> <!--{if $forum['moderators']}--><!--{if $moddisplay == 'flat'}--><img src="{IMGDIR}/moderator.gif" title="Forum Moderator" style="cursor:pointer" /> <em class="moderators" id="coll_1" style="display:none">$forum</em><!--{/if}--><!--{/if}--></h2>
<!--{if $forum}--><p>$forum</p><!--{/if}-->
<!--{if $forum['subforums']}--><p>{lang forum_subforums}: $forum['subforums']</p><!--{/if}-->
</div>
</td>
<th class="forumlast"{$forum}>
<!--{if $forum['permission'] == 1}-->
{lang private_forum}
<!--{else}-->
<!--{if $forum['redirect']}-->
<a href="forumdisplay.php?fid=$forum">{lang url_link}</a>
<!--{elseif is_array($forum['lastpost'])}-->
<p> <a href="redirect.php?tid=$forum&goto=lastpost#lastpost">{echo cutstr($forum, 26)}</a></p>
<cite><!--{if $forum['lastpost']['author']}-->$forum['lastpost']['author']<!--{else}-->{lang anonymous}<!--{/if}--> - $forum</cite>
<!--{else}-->
{lang never}
<p>{lang never}</p>
<!--{/if}-->
<!--{/if}-->
</td>
</tr>
</tbody>
<!--{/loop}-->
<!--{else}-->
<tr class="narrowlist">
<!--{loop $cat['forums'] $forumid}-->
<!--{eval $forum=$forumlist[$forumid];}-->
<!--{if $forum['orderid'] && ($forum['orderid'] % $cat['forumcolumns'] == 0)}-->
</tr></tbody>
<!--{if $forum['orderid'] < $cat['forumscount']}-->
<tbody><tr>
<!--{/if}-->
<!--{/if}-->
<td width="$cat" style="vertical-align: top; background-image: none; padding:8px !important;">
<div style="width:100%; "><div style="float:left; "><h2><a href="forumdisplay.php?fid=$forum" {if $forum}target="_blank" {/if}>$forum</a></h2></div><div style="float:right; "><!--{if $forum['moderators']}--><!--{if $moddisplay == 'flat'}--><img src="{IMGDIR}/moderator.gif" title="论坛版主" style="cursor:pointer" /> <em class="moderators" id="coll_2" style="display:none">$forum</em><!--{/if}--><!--{/if}-->
<!--{if $forum}-->
<!--{else}-->
<!--{/if}--></div></div>
<br>$forum
<!--{if $forum}--><div style="width:100%; ">$forum</div><!--{/if}-->
<!--{if $forum['subforums']}--><div style="width:100%; ">{lang forum_subforums}: $forum['subforums']</div><!--{/if}-->
<!--{if $forum}-->Today: <font color="#FF3399">$forum</font><img src="{IMGDIR}/new.gif" align="absmiddle"><!--{else}-->Today: <font color="#FF3399">0</font><!--{/if}--> Post: <font color="#00CCFF">$forum</font> Reply: <font color="#99CC00">$forum</font></font><br /><br />
<ul style="background-image: url(images/listbg_li.gif); padding:1px 2px 0px 10px; list-style-type: none; line-height: 20px; clear: both; margin:8px 0; ">
<!--{loop ${"new_no".$forum."_threadlist"} $row}-->
<div style="overflow: hidden; height:20px; width:100%"><small style="float:right; color:#9C8B88; margin: 0 0 0 5px">$row['date']</small><a href="viewthread.php?tid=$row" title="$row" target='_self'>$row</a></div>
<!--{/loop}-->
</ul>
</td>
<!--{/loop}-->
$cat['endrows']เปิดไฟล์ templates/default/forumdisplay_subforum.htm ค้นหา<!--{if !$forum['forumcolumns']}-->
จนถึง
<!--{loop $sublist $sub}-->เปลี่ยนเป็น        <!--{if !$forum['forumcolumns']}-->
<!--{loop $sublist $sub}-->
<tbody>
<tr>
<td>
$sub
<div class="left">
<h2><a href="forumdisplay.php?fid=$sub" {if $sub}target="_blank"{/if}>$sub</a> <font class="smalltext"><!--{if $sub && !$sub['redirect']}-->今日: <font color="#FF3399">$forum</font><img src="{IMGDIR}/new.gif" align="absmiddle"><!--{else}-->Today: <font color="#FF3399">0</font><!--{/if}--> Post: <font color="#00CCFF">$forum</font> Reply: <font color="#99CC00">$forum</font></font> <!--{if $sub['moderators']}--><!--{if $moddisplay == 'flat'}--><img src="{IMGDIR}/moderator.gif" title="กระทู้ท่านประธาน" style="cursor:pointer" /> <em class="moderators" id="coll_3" style="display:none">$forum</em><!--{/if}--><!--{/if}--></h2>
<!--{if $sub}--><p>กระทู้แนะนำ: $sub</p><!--{/if}-->
<!--{if $sub['subforums']}--><p>{lang forum_subforums}: $sub['subforums']</p><!--{/if}-->
</div>
</td>
<th class="forumlast"{$forum}>
<!--{if $sub['permission'] == 1}-->
{lang private_forum}
<!--{else}-->
<!--{if $sub['redirect']}-->
<a href="forumdisplay.php?fid=$sub">{lang url_link}</a>
<!--{elseif is_array($sub['lastpost'])}-->
<p>โพสต์ล่าสุด: <a href="redirect.php?tid=$sub&goto=lastpost#lastpost">{echo cutstr($sub, 20)}</a></p>
<cite><!--{if $sub['lastpost']['author']}-->คนโพสต์ล่าสุด: $sub['lastpost']['author']<!--{else}-->คนโพสต์ล่าสุด: {lang anonymous}<!--{/if}--> - $sub</cite>
<!--{else}-->
โพสต์ล่าสุด: {lang never}
<p>คนโพสต์ล่าสุด: {lang never}</p>
<!--{/if}-->
<!--{/if}-->
</td>
</tr>
</tbody>
<!--{/loop}-->
<!--{else}-->
<tr class="narrowlist">
<!--{loop $sublist $sub}-->
ไฟล์ภาพที่ต้องใช้


ไฟล์ภาพนี้ไปไว้ที่สกินที่คุณใช้

realsaks โพสต์ 2010-5-5 18:56:12

ขอบคุณครับ
ว่าแต่อัพข้อมูลไปไว้ที่ไหครับ

GaLonKung โพสต์ 2010-5-5 20:20:47

เปิดไฟล์ templates/default/css_common.htm

ค้นหา .list th { background: url({IMGDIR}/forum.gif) 5px 10px no-repeat; padding-left: 45px !important; }

ตรงนี้ หาไม่เจออ่ะครับ

chooicwwe โพสต์ 2010-5-6 06:44:54

ขอบคุณอย่างสูง

peterza โพสต์ 2010-5-7 19:45:56

ตอบกลับ 3# GaLonKung


    หาไม่เจอด้วยแฮะ แก้ไงดี

momozung โพสต์ 2010-5-8 13:29:47

knot06666 โพสต์ 2010-5-22 14:39:16

ขอบคุณมากก ครับ !!

peterza โพสต์ 2010-5-22 15:44:10

ตอบกลับ 1# konggang


    .list th { background: url({IMGDIR}/forum.gif) 5px 10px no-repeat; padding-left: 45px !important; }

หาไม่เจอ ช่วยแนะทีครับ

konggang โพสต์ 2010-5-27 01:01:12

แก้ไขล่าสุดโดย konggang เมื่อ 2010-5-27 01:04

ตอบกลับ 9# jay17

ตอบกลับ 8# peterza

    โค้ดที่ให้หานี้ บางสกินอาจจะไมเหมือนกันก็ได้ โค้ดที่ผมให้หานั้นมันเป็นโค้ดที่ใช้เกือบทุกสกินอยู่แล้วนะครับ

คุณก็เปลี่ยน Class
.list th ใน CSS_common ให้เป็น.list th { background: url({IMGDIR}/forum.gif) 3px 17px no-repeat; padding-left: 15px !important; }บอกได้นะครับหากมีข้อสงสัย ^^

jay17 โพสต์ 2010-5-27 01:32:10

แก้ไขล่าสุดโดย konggang เมื่อ 2010-5-27 01:04

ตอบกลับjay17

ตอบก ...
ต้นฉบับโพสต์โดย konggang เมื่อ 2010-5-27 01:01 http://www.discuzthai.com/images/common/back.gif


   


ขอบคุณสำหรับคำแนะนำ ยังไงผมก็ต้องอภัยด้วยนะครับ ที่ใจร้อนไปหน่อย
หน้า: [1] 2
ดูในรูปแบบกติ: Mod หน้าหลักแสดงกระทู้ล่าสุด 5 อันดับ ++!