今天很冷,寒风夹杂着点小雨,有点快下雪的感觉。连续上了两天的课,乘今天休息,把艺术部落拿来折腾折腾。呵呵,到dz论坛搜索了一下插件,终于找到个令我满意的横排插件。立即装上它,大功告成!请看效果:
Highslide JS



引用下论坛的修改方法,做个记录:

1。修改模板 discuz.htm , 

先搜尋:
<!--{loop $cat['forums'] $forumid}-->


其上面的 前3行 會看到
<!--{else}-->


修改來了,找到下面這一段:
  <!--{else}-->
     <tr>
     <!--{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}-->
      <th width="$cat[forumcolwidth]"{$forum[folder]}>
       <h2><a href="forumdisplay.php?fid=$forum[fid]">$forum[name]</a><!--{if $forum[todayposts]}--><em> ({lang index_today}: $forum[todayposts])</em><!--{/if}--></h2>
       <p>{lang forum_threads}: $forum[threads], {lang forum_posts}: $forum[posts]</p>
       <p>{lang forum_lastpost}:
        <!--{if is_array($forum['lastpost'])}-->
         <a href="redirect.php?tid=$forum[lastpost][tid]&goto=lastpost#lastpost">$forum[lastpost][dateline]</a>
         {lang forum_lastpost_by} <!--{if $forum['lastpost']['author']}-->$forum['lastpost']['author']<!--{else}-->{lang anonymous}<!--{/if}-->
        <!--{else}-->
         {lang never}
        <!--{/if}-->
       </p>
      </th>
     <!--{/loop}-->
    $cat['endrows']
   <!--{/if}-->


替換為如下內容:

你的橫版設定,
一行板塊數量若有4個,那 "{lang forum_name} / 最新主题" 就放4行
一行2個板塊,那 "{lang forum_name} / 最新主题" 就放2行
請自行改囉



   <!--{else}-->
    <thead class="category" align="center">
     <tr>
      <th>{lang forum_name} / 最新主题</th>
      <th>{lang forum_name} / 最新主题</th>
      <th>{lang forum_name} / 最新主题</th>
     </tr>
    </thead>    
     <!--{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}-->
      <th class="forumlist" width="$cat[forumcolwidth]" style="vertical-align: top; background-image: none; padding:8px !important;">
       <h2 style="margin: 0 0 5px 0"><a href="forumdisplay.php?fid=$forum[fid]">$forum[name]</a></h2>
        <span style="float:left">$forum[icon]</span><span style="float:left; color:{LIGHTTEXT}">$forum[description]</span>
       <ul class="list" 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[fid]."_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[tid]" title="$row[subject]" target='_self'>$row[view_subject]</a></div>
       <!--{/loop}-->
       </ul>
       <div style="color:{LIGHTTEXT}; overflow: hidden; height: 20px; width: 100%">
        <!--{if is_array($forum['lastpost'])}-->
         {lang forum_lastpost}: <a style="color:{LIGHTTEXT}" href="redirect.php?tid=$forum[lastpost][tid]&goto=lastpost#lastpost" title="$forum[lastpost][subject]  ($forum[lastpost][dateline])">{echo cutstr($forum[lastpost][subject], 35)}</a>
         ({lang forum_lastpost_by} <!--{if $forum['lastpost']['author']}-->$forum['lastpost']['author'])<!--{else}-->{lang anonymous}<!--{/if}-->
        <!--{else}-->
         {lang never}
        <!--{/if}-->
       </div>
       <div style="text-align: left; color:{LIGHTTEXT}">
        {lang forum_threads}:{if $forum['redirect']}--{else}$forum[threads]{/if},
        {lang forum_posts}:{if $forum['redirect']}--{else}$forum[posts]{/if},
        <!--{if $forum[todayposts]}-->{lang index_today}$forum[todayposts],<!--{else}-->{lang index_today}:0<!--{/if}-->
       </div>
      </th>
     <!--{/loop}-->
    $cat['endrows']  
   <!--{/if}-->


如果不要   最後發表,  統計主題,帖數,今日新帖   這些的,

請把其中的這一段拿掉
       <div style="color:{LIGHTTEXT}; overflow: hidden; height: 20px; width: 100%">
        <!--{if is_array($forum['lastpost'])}-->
         {lang forum_lastpost}: <a style="color:{LIGHTTEXT}" href="redirect.php?tid=$forum[lastpost][tid]&goto=lastpost#lastpost" title="$forum[lastpost][subject]  ($forum[lastpost][dateline])">{echo cutstr($forum[lastpost][subject], 35)}</a>
         ({lang forum_lastpost_by} <!--{if $forum['lastpost']['author']}-->$forum['lastpost']['author'])<!--{else}-->{lang anonymous}<!--{/if}-->
        <!--{else}-->
         {lang never}
        <!--{/if}-->
       </div>
       <div style="text-align: left; color:{LIGHTTEXT}">
        {lang forum_threads}:{if $forum['redirect']}--{else}$forum[threads]{/if},
        {lang forum_posts}:{if $forum['redirect']}--{else}$forum[posts]{/if},
        <!--{if $forum[todayposts]}-->{lang index_today}$forum[todayposts],<!--{else}-->{lang index_today}:0<!--{/if}-->
       </div>

2。修改程序 index.php  

找到

$newthreads = round(($timestamp - $lastvisit + 600) / 1000) * 1000;


在下面加上:
(其實 模版已定義了超出寬度要隱藏, 所以下面的標題長度可以不用改小)
(下面的dateline是最新發布的主題。如果要顯示最後回覆的,把dateline改成lastpost就可以了)--12/7 補充此行
$hack_cut_str =60; // 这里修改标题长度
$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; // 这里是第一处调用条数需要和后面的设置一样。
                }
        }
}
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; // 这里是第二处调用条数需要和前面的设置一样。
        }
}
$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[0]);
                        $row['highlight'] = 'style="';
                        $row['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
                        $row['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
                        $row['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
                        $row['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
                        $row['highlight'] .= '"';
        } else {
                        $row['highlight'] = '';
        }
        ${'new_no'.$row['fid'].'_threadlist'}[] = $row;
}
//帖子调用结束


From: 本站原创
已经有0个回复 引用(0)
看完了要说点啥?

昵称

网址

电邮

打开UBB 表情 打开表情 隐藏 记住我 [注册]