以下
文件为
程序文件,
文件扩展名为
php.
客户要求调用某个版块下的精华帖,想了很久,也没有
解决.
网络上都是调用全部精华的, 而没有设置可以调用某一版块!!所以现在改成这样的
代码,就可以解决问题了.
复制内容
代码:
//精华帖
$hack_cut_str = 38; //标题字数
$hack_cut_strauthor = 9;
$new_digest_threadlist = array();
$dthread = array();
$dtime=$timestamp-3600*24*360;//最后30是天数为本月
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE digest>'0' AND t.fid='68' AND f.fid=t.fid ORDER BY t.dateline DESC LIMIT 0, 7"); //调用版块ID为68的精华.
while($dthread = $db->fetch_array($query)) {
$dthread['forumname'] = ereg_replace('<[^>]*>','',$dthread['name']);
$dthread['view_subject'] = cutstr($dthread['subject'],$hack_cut_str);
$dthread['view_lastposter'] = cutstr($dthread['lastposter'],$hack_cut_strauthor);
$dthread['date']= gmdate("$dateformat $timeformat", $dthread['dateline'] + $timeoffset * 3600);
$dthread['lastreplytime']= gmdate("$dateformat $timeformat", $dthread[lastpost] + ($timeoffset * 3600));
if($dthread['highlight']) {
$string = sprintf('%02d', $dthread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$dthread['highlight'] = 'style="';
$dthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$dthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$dthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$dthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
$dthread['highlight'] .= '"';
} else {
$dthread['highlight'] = '';
}
$new_digest_threadlist[] = $dthread;
}
//完毕//digest>'0' 表示, 一定要有值!!!,就代表精华123了.