最簡單的方法就是放在viewfourm 中\r
基本上,最不容易出錯的就是這種方法....
對了!我改好了 ^^
OPEN 打開
FIND 找到\r
代碼: 選擇全部
//
// Mozilla navigation bar
//
$nav_links['up'] = array(
'url' => append_sid('index.'.$phpEx),
'title' => sprintf($lang['Forum_Index'], $board_config['sitename'])
);
AFTER, ADD 在之後加入\r
代碼: 選擇全部
//
// TOP5 MOD Begin Edit by bu MOD by OOHOO
//
//
// Mod setting
//
// Topics text length
$MAX_STR_LEN = 60;
// Topics to display
$MAX_TOPICS = 5;
// 0 => users can see all topics including authorized issue(but they cant read the posts)
// 1 => users can see only authorized topics
$AUTH_SECRUITY = 1;
function cutStr($str) {
global $MAX_STR_LEN;
$str = (strlen($str) > $MAX_STR_LEN) ? (substr($str, 0, $MAX_STR_LEN - 1) . "...") : $str;
return $str;
}
// query
$sql = "SELECT topic_id, topic_title, topic_poster, topic_views, topic_replies, topic_last_post_id, f.forum_id, forum_name
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
WHERE t.forum_id = '".$forum_id."'
AND topic_moved_id = '0'
$auth_forums \r
ORDER BY topic_last_post_id DESC LIMIT 0, $MAX_TOPICS";
if( !$result = $db->sql_query($sql) )
{
echo '<p align="center"><font color="red"><b>ADV_TOPN_MOD TOPICS QUERY ERROR!!</b></font></p>';
exit;
}
// fetch rows
while( $rows = $db->sql_fetchrow($result) )
{
$topic_url = append_sid("viewtopic.$phpEx?t=" . $rows['topic_id']);
$topic_poster = $rows['topic_poster'];
$topic_last_post_id = $rows['topic_last_post_id'];
// Grab topic poster and last replier data
$sql = "SELECT post_username, user_id, username
FROM " . POSTS_TABLE . ", " . USERS_TABLE . "
WHERE topic_id = '" . $rows['topic_id'] . "'
AND poster_id = user_id
ORDER BY post_id LIMIT 0, 1";
if( !$p_result = $db->sql_query($sql) )
{
message_die(GENERAL_MESSAGE, 'ADV_TOP5 MOD TOPIC_POSTER QUERY ERROR!!');
}
$p_row = $db->sql_fetchrow($p_result);
$poster_name = ( $topic_poster != ANONYMOUS ) ? $p_row['username'] : ( !$p_row['post_username'] ? $lang['Guest'] : $p_row['post_username']);
$poster_url = ( $topic_poster != ANONYMOUS && !$p_row['post_username'] ) ? ('<a href="' . append_sid("profile.$phpEx?mode=viewprofile&u=$topic_poster") . '" target="_top">' . "$poster_name</a>") : $poster_name;
$sql = "SELECT post_username, user_id, username, post_time
FROM " . POSTS_TABLE . ", " . USERS_TABLE . "
WHERE post_id = '$topic_last_post_id'
AND poster_id = user_id";
if( !$r_result = $db->sql_query($sql) )
{
message_die(GENERAL_MESSAGE, 'ADV_TOP5 MOD LAST_REPLIER QUERY ERROR!!');
}
$r_row = $db->sql_fetchrow($r_result);
$replier_id = $r_row['user_id'];
$replier_name = ( $replier_id != ANONYMOUS ) ? $r_row['username'] : ( !$r_row['post_username'] ? $lang['Guest'] : $r_row['post_username']);
$replier_url = ( $replier_id != ANONYMOUS && !$r_row['post_username'] ) ? ('<a href="' . append_sid("profile.$phpEx?mode=viewprofile&u=$replier_id") . '" target="_top">' . "$replier_name</a>") : $replier_name;
$last_post_url = append_sid("viewtopic.$phpEx?p=$topic_last_post_id#$topic_last_post_id");
$template->assign_block_vars("top5row", array(
"topic" => cutStr($rows['topic_title']),
"topic_url" => $topic_url,
"topic_views" => $rows['topic_views'],
"topic_replies" => $rows['topic_replies'],
"post_time" => create_date($board_config['default_dateformat'], $r_row['post_time'], $board_config['board_timezone']),
"poster_url" => $poster_url,
"replier_url" => $replier_url,
"last_post_url" => $last_post_url
));
}
//
// TOP5 MOD END Edit by bu
//
FIND 找到\r
代碼: 選擇全部
'L_AUTHOR' => $lang['Author'],
AFTER, ADD 在之後加入\r
代碼: 選擇全部
'icon_url' => $images['icon_latest_reply'], // TOP5
'icon_alt' => $lang['View_latest_post'], // TOP5
OPEN 打開
代碼: 選擇全部
viewforum_body.tpl
FIND A PLACE, PUT 找個好地方,放入\r
代碼: 選擇全部
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0" style="background-color: white">
<tr><td height="18" valign="top"><span class="nav">{nav_links}</span></td></tr>
<tr>
<td valign="top">
<table width="100%" border="0" cellpadding="4" cellspacing="1" width="100%" class="forumline">
<tr>
<th align="center" class="thTop" width="40%"> {L_TOPICS} </th>
<th align="center" class="thTop" nowrap> {L_AUTHOR} </th>
<th align="center" class="thTop" nowrap> {L_REPLIES} </th>
<th align="center" class="thTop" nowrap> {L_VIEWS} </th>
<th align="center" class="thCornerR" nowrap> {L_LASTPOST} </th>
</tr>
<!-- BEGIN top5row -->
<tr>
<td class="row2" nowrap><span class="topictitle"><a href="{top5row.topic_url}" target="_top" class="topictitle">{top5row.topic}</a></span></td>
<td class="row1" align="center" nowrap><span class="name">{top5row.poster_url}</span></td>
<td class="row2" align="center" nowrap><span class="postdetails">{top5row.topic_replies}</span></td>
<td class="row1" align="center" nowrap><span class="postdetails">{top5row.topic_views}</span></td>
<td class="row2" align="center" nowrap><span class="postdetails">{top5row.post_time}<br />{top5row.replier_url} <a href="{top5row.last_post_url}" target="_top"><img src="{icon_url}" border="0" alt="{icon_alt}" /></a></span></td>
</tr>
<!-- END top5row -->
</table>
</td>
</tr>
</table>
完成 ^^
如果想和蕭大哥的一樣是人氣數排名
請找到 [php]<?php// query
$sql = "SELECT topic_id, topic_title, topic_poster, topic_views, topic_replies, topic_last_post_id, f.forum_id, forum_name
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
WHERE t.forum_id = '".$forum_id."'
AND topic_moved_id = '0'
$auth_forums
ORDER BY topic_last_post_id DESC LIMIT 0, $MAX_TOPICS";
?>[/php]
改成 [php]<?php// query
$sql = "SELECT topic_id, topic_title, topic_poster, topic_views, topic_replies, topic_last_post_id, f.forum_id, forum_name
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
WHERE t.forum_id = '".$forum_id."'
AND topic_moved_id = '0'
$auth_forums
ORDER BY topic_views DESC LIMIT 0, $MAX_TOPICS";
?>[/php]