home

Relative Topics MOD

作用:相似主题。
方法:打开viewtopic.php
搜索:

  1. $template->pparse('body');

在上面添加:

  1. /**
  2.  * Relative Topics MOD
  3.  * @ Author  : (1) Dean Newman
  4.  * @ Website : http://www.ugboards.com
  5.  */
  6.  
  7. $is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);
  8. $valid_forum_list = implode(',', array_keys($is_auth_ary));
  9.  
  10. $sql = 'SELECT t.*, p.post_id, p.poster_id, f.*, u.username AS topic_username, u2.username AS post_username
  11.          FROM ( ' . FORUMS_TABLE . ' f
  12.             LEFT JOIN ' . TOPICS_TABLE . ' t ON ( t.forum_id = f.forum_id )
  13.             LEFT JOIN ' . USERS_TABLE . ' u ON ( t.topic_poster = u.user_id )
  14.             LEFT JOIN ' . POSTS_TABLE . ' p ON ( t.topic_last_post_id = p.post_id )
  15.             LEFT JOIN ' . USERS_TABLE . ' u2 ON ( p.poster_id = u2.user_id ) )
  16.                WHERE t.topic_title LIKE \'%' . str_replace(array('\'', '\\'), array('\'\'', '\\\\'), $topic_title) . '%\'
  17.                   AND f.forum_id IN (' . $valid_forum_list . ')
  18.                   AND t.topic_id <> ' . $topic_id . '
  19.                      ORDER BY p.post_time DESC
  20.                         LIMIT 5';
  21. if ( ! $result = $db->sql_query($sql) )
  22. {
  23.    message_die ( GENERAL_ERROR, 'Unable to query relative topic results', '', __LINE__, __FILE__, $sql );
  24. }
  25.  
  26. $topics = array();
  27. while ( $row = $db->sql_fetchrow($result) )
  28. {
  29.    $topics[] = $row;
  30. }
  31.  
  32. $db->sql_freeresult($result);
  33.  
  34. if ( sizeof ( $topics ) )
  35. {
  36.    $template->assign_vars(array(
  37.       'L_RELATIVE_TOPICS'   => $lang['Relative_Topics'],
  38.       'L_TOPIC_TITLE'   => $lang['Topic'],
  39.       'L_FORUM'      => $lang['Forum'],
  40.       'L_AUTHOR'      => $lang['Author'],
  41.       'L_REPLIES'      => $lang['Replies'],
  42.       'L_VIEWS'      => $lang['Views'],
  43.       'L_LAST_POST'   => $lang['Last_Post'],
  44.       'L_BY'         => $lang['By'] )
  45.    );
  46.  
  47.    $template->assign_block_vars('relative_topics', array());
  48.  
  49.    for ( $i = 0 ; $i < sizeof ( $topics ) ; $i++ )
  50.    {
  51.       $template->assign_block_vars('relative_topics.topicrow', array(
  52.          'ROW_COLOR'   => ( $i % 2 ) ? 'row1' : 'row2',
  53.          'TOPIC'      => $topics[$i]['topic_title'],
  54.          'FORUM'      => $topics[$i]['forum_name'],
  55.          'AUTHOR'   => $topics[$i]['topic_username'],
  56.          'REPLIES'   => $topics[$i]['topic_replies'],
  57.          'VIEWS'      => $topics[$i]['topic_views'],
  58.          'POST_USER'   => $topics[$i]['post_username'],
  59.          'POST_TIME'   => create_date($board_config['default_dateformat'], $topics[$i]['post_time'], $board_config['board_timezone']),
  60.  
  61.          'U_POST'   => append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $topics[$i]['post_id']),
  62.          'U_TOPIC'   => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $topics[$i]['topic_id']),
  63.          'U_FORUM'   => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . '=' . $topics[$i]['forum_id']),
  64.          'U_AUTHOR'   => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . '=' . $topics[$i]['topic_poster']),
  65.          'U_POST_USER'   => append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . '=' . $topics[$i]['poster_id']) )
  66.       );
  67.    }
  68. }</code>
  69. 打开:templates/subSilver/viewtopic_body.tpl
  70.  
  71. 搜索:<code><td align="left" colspan="3"><span class="nav">{PAGE_NUMBER}</span></td>
  72.   </tr>
  73. </table>

在下面添加:

  1. <!-- BEGIN relative_topics -->
  2. <!--| Relative topics MOD by Dean Newman, http://phpbbmodders.com/viewtopic.php?t=434 |-->
  3. <table width="100%" cellspacing="1" cellpadding="5" border="0" class="forumline">
  4.    <tr>
  5.       <th colspan="5" height="26">{L_RELATIVE_TOPICS}</th>
  6.    </tr>
  7.    <tr>
  8.       <td class="catLeft" align="left"><span class="cattitle">{L_TOPIC_TITLE}</span></td>
  9.       <td class="catLeft" width="100px" align="center"><span class="cattitle">{L_AUTHOR}</span></td>
  10.       <td class="catLeft" width="150px" align="center"><span class="cattitle">{L_FORUM}</span></td>
  11.       <td class="catLeft" width="65px" align="center"><span class="cattitle">{L_REPLIES}</span></td>
  12.       <td class="catLeft" width="65px" align="center"><span class="cattitle">{L_VIEWS}</span></td>
  13.       
  14.    </tr>
  15.    <!-- BEGIN topicrow -->
  16.    <tr>
  17.       <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>
  18.       <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>
  19.       <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>
  20.       <td align="center" class="{relative_topics.topicrow.ROW_COLOR}"><span class="gensmall">{relative_topics.topicrow.REPLIES}</span></td>
  21.       <td align="center" class="{relative_topics.topicrow.ROW_COLOR}"><span class="gensmall">{relative_topics.topicrow.VIEWS}</span></td>
  22.       
  23.    </tr>
  24.    <!-- END topicrow -->
  25. </table>
  26. <!-- END relative_topics -->

Created By: sb123

Form Page: Relative Topics MOD


留言中至少要有一个中文字

Leave a Reply