Discuz! 6.0.0 RC1首页四格 教程 (方法简单)
演示地址: http://www.timizhou.cn/bbs/index.html
方法 :请先下载 附件
第一步: 修改 index.php 找到$newthreads = round(($timestamp - $lastvisit + 600) / 1000) * 1000;
在下面加
//四格代码//
$colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
//新贴//
$hack_cut_str =28; //修改标题显示字数
$hack_cut_strauthor = 9;
$new_post_threadlist = array();
$nthread = array();
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid AND t.displayorder>='0' ORDER BY t.dateline DESC LIMIT 0, 10");
while($nthread = $db->fetch_array($query)) {
$nthread['forumname'] = ereg_replace('<[^>]*>','',$nthread['name']);
$nthread['view_subject'] = cutstr($nthread['subject'],$hack_cut_str);
$nthread['view_author'] = cutstr($nthread['author'],$hack_cut_strauthor);
$nthread['date']= gmdate("$dateformat $timeformat", $nthread['dateline'] + $timeoffset * 3600);
$nthread['lastreplytime']= gmdate("$dateformat $timeformat", $nthread[lastpost] + ($timeoffset * 3600));
if($nthread['highlight']) {
$string = sprintf('%02d', $nthread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$nthread['highlight'] = 'style="';
$nthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$nthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$nthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$nthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
$nthread['highlight'] .= '"';
} else {
$nthread['highlight'] = '';
}
$new_post_threadlist[] = $nthread;
}
//新贴//
//回覆//
$hack_cut_str = 28; //修改标题显示字数
$hack_cut_strauthor = 9;
$new_reply_threadlist = array();
$rthread = array();
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid AND t.displayorder>='0' AND t.closed NOT LIKE 'moved|%' AND t.replies !=0 ORDER BY t.lastpost DESC LIMIT 0, 10");
while($rthread = $db->fetch_array($query)) {
$rthread['forumname'] = ereg_replace('<[^>]*>','',$rthread['name']);
$rthread['view_subject'] = cutstr($rthread['subject'],$hack_cut_str);
$rthread['view_lastposter'] = cutstr($rthread['lastposter'],$hack_cut_strauthor);
$rthread['date']= gmdate("$dateformat $timeformat", $rthread['dateline'] + $timeoffset * 3600);
$rthread['lastreplytime']= gmdate("$dateformat $timeformat", $rthread[lastpost] + ($timeoffset * 3600));
if($rthread['highlight']) {
$string = sprintf('%02d', $rthread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$rthread['highlight'] = 'style="';
$rthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$rthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$rthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$rthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
$rthread['highlight'] .= '"';
} else {
$rthread['highlight'] = '';
}
$new_reply_threadlist[] = $rthread;
}
//回覆//
//热帖//
$hack_cut_str = 30; //修改标题显示字数
$hack_cut_strauthor = 10; //热贴指定天数//
$this_time= time();
$sort_time = $today - ( 60*60*24*7); //括号最后一位数代表x天内
$new_hot_threadlist = array();
$mthread = array();
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid AND t.displayorder>='0' AND t.closed NOT LIKE 'moved|%' AND t.replies !=0 and t.dateline > $sort_time ORDER BY t.views DESC LIMIT 0, 10"); //修改显示帖子条数
while($mthread = $db->fetch_array($query)) {
$mthread['forumname'] = ereg_replace('<[^>]*>','',$mthread['name']);
$mthread['view_subject'] = cutstr($mthread['subject'],$hack_cut_str);
$mthread['view_lastposter'] = cutstr($mthread['lastposter'],$hack_cut_strauthor);
$mthread['date']= gmdate("$dateformat $timeformat", $mthread['dateline'] + $timeoffset * 3600);
$mthread['lastreplytime']= gmdate("$dateformat $timeformat", $mthread[lastpost] + ($timeoffset * 3600));
if($mthread['highlight']) {
$string = sprintf('%02d', $mthread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$mthread['highlight'] = 'style="';
$mthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$mthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$mthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$mthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
$mthread['highlight'] .= '"';
} else {
$mthread['highlight'] = '';
}
$new_hot_threadlist[] = $mthread;
}
//热帖//
//四格代码结束//
第二步: 修改 templates\default 目录下 discuz.htm 文件。
找到 [supe_updateitems]');</script></table>
</div><br></div>
<!--{/if}--> 后 在下面增加
: <!--首页四格开始-->
<div class="spaceborder spacebottom" style="width: {TABLEWIDTH}; clear: both; margin-top: 5px;">
<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%" align="center">
<tr class="header">
<td width="30%"><a href="#" onclick="toggle_collapse('top10');"><b>» 图片推荐</b></a></td>
<td width="24%"><a href="#" onclick="toggle_collapse('top10');"><b>» 最新主题</b></a></td>
<td width="24%"><a href="#" onclick="toggle_collapse('top10');"><b>» 最新回复</b></a></td>
<td width="20%"><a href="#" onclick="toggle_collapse('top10');"><b>» 本周热点</b></a></td>
<td><div class="right"><a href="#" onclick="toggle_collapse('top10');"><img id="top10_img" src="{IMGDIR}/collapsed_no.gif" border="0" alt="" /></a> </div></td>
</tr>
<tbody id="top10">
<tr>
<td align="middle" valign="bottom"><iframe src="pic.php" width="270" height="250" frameborder=0 scrolling=no marginwidth="8" marginheight="8"></iframe>
</td>
<td valign="top">
<div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td width="24" background="images/yelia/nature/rank.gif"></td>
<td background="images/yelia/nature/rankbg.gif" style="line-height:26px" valign="top">
<!--{loop $new_post_threadlist $nthread}-->
<!--{if $nthread[replies]}-->
<a href="viewthread.php?tid=$nthread[tid]" $nthread['highlight'] title="论坛: $nthread[forumname]{LF}主题: $nthread[subject] {LF}作者: $nthread[author]{LF}发表: $nthread[date]{LF}点击: $nthread[views] {LF}回复: $nthread[replies] {LF}更新: $nthread[lastposter]{LF}时间: $nthread[lastreplytime]" >$nthread[view_subject]</a><br>
<!--{else}-->
<a href="viewthread.php?tid=$nthread[tid]" $nthread['highlight'] title="论坛: $nthread[forumname]{LF}主题: $nthread[subject] {LF}作者: $nthread[author]{LF}发表: $nthread[date]{LF}点击: $nthread[views] {LF}回复: $nthread[replies] {LF}更新: 暂时没有回复" >$nthread[view_subject]</a><br>
<!--{/if}-->
<!--{/loop}-->
</td>
</tr>
</tbody>
</table>
</div>
</td>
<td valign="top">
<div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td width="24" background="images/yelia/nature/rank.gif"></td>
<td background="images/yelia/nature/rankbg.gif" style="line-height:26px" valign="top">
<!--{loop $new_reply_threadlist $rthread}-->
<a href="viewthread.php?tid=$rthread[tid]" $rthread['highlight'] title="论坛: $rthread[forumname]{LF}主题: $rthread[subject]{LF}作者: $rthread[author]{LF}发表: $rthread[date]{LF}点击: $rthread[views] {LF}回复: $rthread[replies] {LF}更新: $rthread[lastposter]{LF}时间: $rthread[lastreplytime]">$rthread[view_subject]</a><br>
<!--{/loop}-->
</td>
</tr>
</tbody>
</table>
</div>
</td>
<td colspan="2" valign="top">
<div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td width="24" background="images/yelia/nature/rank.gif"></td>
<td background="images/yelia/nature/rankbg.gif" style="line-height:26px" valign="top">
<!--{loop $new_hot_threadlist $mthread}-->
<a href="viewthread.php?tid=$mthread[tid]" $mthread['highlight'] title="论坛: $mthread[forumname]{LF}主题: $mthread[subject]{LF}作者: $mthread[author]{LF}发表: $mthread[date]{LF}点击: $mthread[views] {LF}回复: $mthread[replies] {LF}更新: $mthread[lastposter]{LF}时间: $mthread[lastreplytime]">$mthread[view_subject]</a><br>
<!--{/loop}-->
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<!--首页四格结束-->
第三步:上传附件 pic.php上传于论坛根目录。 images 覆盖所在风格目录 (附件目录 我已经设置好 。请把 原始文件做个备分。如果安装其他风格,需要在每个风格里面进行以上操作)
如果没有弄好 可以加:731730618 愿意 提供帮助
附件路径以设置好
QQ:731730618 愿意提供帮助
有人 不知道 discuz.htm 增加位置
我 把discuz.htm 上传上来了 在 第20楼!!!!!
[ 本帖最后由 timizhou 于 2007-7-28 21:43 编辑 ] |