Relative Topics MOD
作用:相似主题。
方法:打开viewtopic.php
搜索:
- $template->pparse('body');
在上面添加:
- /**
- * Relative Topics MOD
- * @ Author : (1) Dean Newman
- * @ Website : http://www.ugboards.com
- */
- $is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);
- $valid_forum_list = implode(',', array_keys($is_auth_ary));
- $sql = 'SELECT t.*, p.post_id, p.poster_id, f.*, u.username AS topic_username, u2.username AS post_username
- FROM ( ' . FORUMS_TABLE . ' f
- LEFT JOIN ' . TOPICS_TABLE . ' t ON ( t.forum_id = f.forum_id )
- LEFT JOIN ' . USERS_TABLE . ' u ON ( t.topic_poster = u.user_id )
- LEFT JOIN ' . POSTS_TABLE . ' p ON ( t.topic_last_post_id = p.post_id )
- LEFT JOIN ' . USERS_TABLE . ' u2 ON ( p.poster_id = u2.user_id ) )
- WHERE t.topic_title LIKE \'%' . str_replace(array('\'', '\\'), array('\'\'', '\\\\'), $topic_title) . '%\'
- AND f.forum_id IN (' . $valid_forum_list . ')
- AND t.topic_id <> ' . $topic_id . '
- ORDER BY p.post_time DESC
- LIMIT 5';
- if ( ! $result = $db->sql_query($sql) )
- {
- message_die ( GENERAL_ERROR, 'Unable to query relative topic results', '', __LINE__, __FILE__, $sql );
- }
- $topics = array();
- while ( $row = $db->sql_fetchrow($result) )
- {
- $topics[] = $row;
- }
- $db->sql_freeresult($result);
- if ( sizeof ( $topics ) )
- {
- $template->assign_vars(array(
- 'L_RELATIVE_TOPICS' => $lang['Relative_Topics'],
- 'L_TOPIC_TITLE' => $lang['Topic'],
- 'L_FORUM' => $lang['Forum'],
- 'L_AUTHOR' => $lang['Author'],
- 'L_REPLIES' => $lang['Replies'],
- 'L_VIEWS' => $lang['Views'],
- 'L_LAST_POST' => $lang['Last_Post'],
- 'L_BY' => $lang['By'] )
- );
- $template->assign_block_vars('relative_topics', array());
- for ( $i = 0 ; $i < sizeof ( $topics ) ; $i++ )
- {
- $template->assign_block_vars('relative_topics.topicrow', array(
- 'ROW_COLOR' => ( $i % 2 ) ? 'row1' : 'row2',
- 'TOPIC' => $topics[$i]['topic_title'],
- 'FORUM' => $topics[$i]['forum_name'],
- 'AUTHOR' => $topics[$i]['topic_username'],
- 'REPLIES' => $topics[$i]['topic_replies'],
- 'VIEWS' => $topics[$i]['topic_views'],
- 'POST_USER' => $topics[$i]['post_username'],
- 'POST_TIME' => create_date($board_config['default_dateformat'], $topics[$i]['post_time'], $board_config['board_timezone']),
- 'U_POST' => append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $topics[$i]['post_id']),
- 'U_TOPIC' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $topics[$i]['topic_id']),
- 'U_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . '=' . $topics[$i]['forum_id']),
- 'U_AUTHOR' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $topics[$i]['topic_poster']),
- 'U_POST_USER' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $topics[$i]['poster_id']) )
- );
- }
- }</code>
- 打开:templates/subSilver/viewtopic_body.tpl
- 搜索:<code><td align="left" colspan="3"><span class="nav">{PAGE_NUMBER}</span></td>
- </tr>
- </table>
在下面添加:
- <!-- BEGIN relative_topics -->
- <!--| Relative topics MOD by Dean Newman, http://phpbbmodders.com/viewtopic.php?t=434 |-->
- <table width="100%" cellspacing="1" cellpadding="5" border="0" class="forumline">
- <tr>
- <th colspan="5" height="26">{L_RELATIVE_TOPICS}</th>
- </tr>
- <tr>
- <td class="catLeft" align="left"><span class="cattitle">{L_TOPIC_TITLE}</span></td>
- <td class="catLeft" width="100px" align="center"><span class="cattitle">{L_AUTHOR}</span></td>
- <td class="catLeft" width="150px" align="center"><span class="cattitle">{L_FORUM}</span></td>
- <td class="catLeft" width="65px" align="center"><span class="cattitle">{L_REPLIES}</span></td>
- <td class="catLeft" width="65px" align="center"><span class="cattitle">{L_VIEWS}</span></td>
- </tr>
- <!-- BEGIN topicrow -->
- <tr>
- <td align="left" class="{relative_topics.topicrow.ROW_COLOR}"><span class="gensmall"><a href="{relative_topics.topicrow.U_TOPIC}" class="topictitle">{relative_topics.topicrow.TOPIC}</a></span></td>
- <td align="center" class="{relative_topics.topicrow.ROW_COLOR}"><span class="gensmall"><a href="{relative_topics.topicrow.U_AUTHOR}" class="gensmall">{relative_topics.topicrow.AUTHOR}</a></span></td>
- <td align="center" class="{relative_topics.topicrow.ROW_COLOR}"><span class="gensmall"><a href="{relative_topics.topicrow.U_FORUM}" class="gensmall">{relative_topics.topicrow.FORUM}</a></span></td>
- <td align="center" class="{relative_topics.topicrow.ROW_COLOR}"><span class="gensmall">{relative_topics.topicrow.REPLIES}</span></td>
- <td align="center" class="{relative_topics.topicrow.ROW_COLOR}"><span class="gensmall">{relative_topics.topicrow.VIEWS}</span></td>
- </tr>
- <!-- END topicrow -->
- </table>
- <!-- END relative_topics -->
Created By: sb123
Form Page: Relative Topics MOD
