原帖由 oursde 于 2008-6-7 23:46 发表
论坛首页看到的是每个板块最后5个主题帖,如何更改成最后5个回复帖子?
index.php 這段
紅字的 t.dateline 改成 t.lastpost 就可以了
//每版最新主题--开始
$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] = 3; // 这里是第一处调用条数需要和后面的设置一样。
}
}
}
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']] = 3; // 这里是第二处调用条数需要和前面的设置一样。
}
}
$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' 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_array($query)){
$row['view_subject'] = cutstr($row['subject'],$hack_cut_str);
$row['date']= gmdate("$dateformat", $row['dateline'] + $timeoffset * 3600);
${'new_no'.$row['fid'].'_threadlist'}[] = $row;
}
//每版最新主题--结束 |