包括手动修改教程和懒人包
演示地址:www.zgz6.com
一、根目录下找到forum.php
编辑这个文件
找到
在下载添加
- <p>//帖子调用开始
- $colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
- $hack_cut_str =60; // 这里修改标题长度
- $fids = array();
- if (file_exists("./data/cache/cache_forums.php")){
- require_once "./data/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 ".DB::table('forum_forum')." WHERE type='forum' OR type='sub'");
- while ($row = DB::fetch($query)){
- $fids[$row['fid']] = 5; // 这里是第二处调用条数需要和前面的设置一样。
- }
- }
- $limit_counts = 0;</p><p>foreach ($fids as $k => $v){
- $sql .= "(SELECT t.*, f.name FROM ".DB::table('forum_thread')." t LEFT JOIN ".DB::table('forum_forum')." f ON f.fid = t.fid WHERE t.fid='$k' AND t.closed NOT LIKE 'moved|%' AND t.displayorder>=0 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($query)){
- $row['view_subject'] = cutstr($row['subject'],$hack_cut_str);
- $row['date']= gmdate('m-d/H:i', $row['dateline'] + $_G['setting']['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;
- }
- //每版最新主题--结束</p>
复制代码 保存。
二、打开/template/default/forum文件夹
找到
- <dt><a href="$forumurl"{if $forum[redirect]} target="_blank"{/if}{if $forum[extra][namecolor]} style="color: {$forum[extra][namecolor]};"{/if}>$forum[name]</a><!--{if $forum[todayposts] && !$forum['redirect']}--><em class="xw0 xi1" title="{lang forum_todayposts}"> ($forum[todayposts])</em><!--{/if}--></dt>
- <!--{if empty($forum[redirect])}--><dd><em>{lang forum_threads}: <!--{echo dnumber($forum[threads])}--></em>, <em>{lang forum_posts}: <!--{echo dnumber($forum[posts])}--></em></dd><!--{/if}-->
- <dd>
- <!--{if $forum['permission'] == 1}-->
- {lang private_forum}
- <!--{else}-->
- <!--{if $forum['redirect']}-->
- <a href="$forumurl" class="xi2">{lang url_link}</a>
- <!--{elseif is_array($forum['lastpost'])}-->
- <!--{if $cat['forumcolumns'] < 3}-->
- <a href="forum.php?mod=redirect&tid=$forum[lastpost][tid]&goto=lastpost#lastpost" class="xi2"><!--{echo cutstr($forum[lastpost][subject], 30)}--></a> <cite>$forum[lastpost][dateline] <!--{if $forum['lastpost']['author']}-->$forum['lastpost']['author']<!--{else}-->$_G[setting][anonymoustext]<!--{/if}--></cite>
- <!--{else}-->
- <a href="forum.php?mod=redirect&tid=$forum[lastpost][tid]&goto=lastpost#lastpost">{lang forum_lastpost}: $forum[lastpost][dateline]</a>
- <!--{/if}-->
- <!--{else}-->
- {lang never}
- <!--{/if}-->
- <!--{/if}-->
- </dd>
- <!--{hook/index_forum_extra $forum[fid]}-->
- </dl>
- </td>
- <!--{else}-->
- <td class="fl_icn" {if !empty($forum[extra][iconwidth]) && !empty($forum[icon])} style="width: {$forum[extra][iconwidth]}px;"{/if}>
- <!--{if $forum[icon]}-->
- $forum[icon]
- <!--{else}-->
- <a href="$forumurl"{if $forum[redirect]} target="_blank"{/if}><img src="{IMGDIR}/forum{if $forum[folder]}_new{/if}.gif" alt="$forum[name]" /></a>
- <!--{/if}-->
- </td>
- <td>
- <h2><a href="$forumurl"{if $forum[redirect]} target="_blank"{/if}{if $forum[extra][namecolor]} style="color: {$forum[extra][namecolor]};"{/if}>$forum[name]</a><!--{if $forum[todayposts] && !$forum['redirect']}--><em class="xw0 xi1" title="{lang forum_todayposts}"> ($forum[todayposts])</em><!--{/if}--></h2>
- <!--{if $forum[description]}--><p class="xg2">$forum[description]</p><!--{/if}-->
- <!--{if $forum['subforums']}--><p>{lang forum_subforums}: $forum['subforums']</p><!--{/if}-->
- <!--{if $forum['moderators']}--><p>{lang forum_moderators}: <span class="xi2">$forum[moderators]</span></p><!--{/if}-->
- <!--{hook/index_forum_extra $forum[fid]}-->
- </td>
- <td class="fl_i">
- <!--{if empty($forum[redirect])}--><span class="xi2"><!--{echo dnumber($forum[threads])}--></span><span class="xg1"> / <!--{echo dnumber($forum[posts])}--></span><!--{/if}-->
- </td>
- <td class="fl_by">
- <div>
- <!--{if $forum['permission'] == 1}-->
- {lang private_forum}
- <!--{else}-->
- <!--{if $forum['redirect']}-->
- <a href="$forumurl" class="xi2">{lang url_link}</a>
- <!--{elseif is_array($forum['lastpost'])}-->
- <a href="forum.php?mod=redirect&tid=$forum[lastpost][tid]&goto=lastpost#lastpost" class="xi2"><!--{echo cutstr($forum[lastpost][subject], 30)}--></a> <cite>$forum[lastpost][dateline] <!--{if $forum['lastpost']['author']}-->$forum['lastpost']['author']<!--{else}-->$_G[setting][anonymoustext]<!--{/if}--></cite>
- <!--{else}-->
- {lang never}
- <!--{/if}-->
- <!--{/if}-->
- </div>
- </td>
- </tr>
- <tr class="fl_row">
- <!--{/if}-->
- <!--{/loop}-->
- $cat['endrows']
复制代码 删除
然后用附件中提供的修改方法修改
最后保存
接着是进入后台更新缓存
ok
免费下载地址:3.1首页横排调用多条数据20140202
http://www.zgz6.com/thread-521-1-1.html
友情提示:修改有风险,请你备份好自己的文件 。遇到有错好恢复。
|