A lot of people like threaded views. (I know - that doesn't include the phpBB development team.)
For those who like threading as a way to navigate - this won't do it.
But a lot of users like to see who has posted to a topic, and how the discussion has evolved.
The solution presented by this MOD is to display, below each topic on the forum listing, the subject and author of each reply.
My community is used to a threaded board, and I think this will make phpBB more accessible to them. And I take their point about wanting to see this information.
The MOD can be seen in use on an active board. There are several styles. This is the style most like a threaded board (modeled after WWWBoard). This is the most subSilver-like style, and the one in the MOD listing.
A word of caution: I am a beginner when it comes to MODs, SQL, and php. So any help will be appreciated.
Code: Select all
##############################################################
## MOD Title: Flat Threaded Forum View
## MOD Author: bilofsky
## MOD Description: Shows threaded-like view in forum listing
## MOD Version: 0.0.3
##
## Installation Level: (Intermediate)
## Installation Time: 10 Minutes
## Files To Edit:
## viewforum.php
## templates/subSilver/viewforum_body.tpl
## templates/subSilver/overall_header.tpl
## language/lang_english/lang_main.php
##
## Included Files: (n/a)
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes: This MOD augments the forum view by listing,
## under each topic subject, the subjects, authors and date/times
## of each reply in the topic.
## This MOD provides just one format with minimal changes
## to the subSilver style. Other changes are possible, and one
## example - which more mimics the threaded look - is also given.
## It is hoped that this will make phpBB more acceptable to
## those who are used to the look of threaded boards (like my users).
##############################################################
## MOD History:
##
## 2005-1-15 - Version 0.0.1
## - first alpha version
## 2005-1-17 - Version 0.0.2
## - Beta version - fix for multiple-page topics
## - Display messages in post time order, not post number (only interesting for
## converted databases)
## 2005-2-24 - Version 0.0.3
## - Bug fix for users using sid (no cookies allowed)
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
## THIS MOD IS ALPHA, DON'T USE IT ON A PRODUCTION BOARD
##############################################################
#
#-----[ OPEN ]----------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]-----------------------------------
#
$lang['View_results'] = 'View Results';
#
#-----[ AFTER, ADD ]-----------------------------------
#
// Flat Thread MOD
lang['No_subject'] = '(reply)';
#
#-----[ OPEN ]----------------------------------------
#
viewforum.php
#
#-----[ FIND ]-----------------------------------
#
$goto_page = ' [ <img src="' . $images['icon_gotopost'] . '" alt="' . $lang['Goto_page'] . '" title="' . $lang['Goto_page'] . '" />' . $lang['Goto_page'] . ': ';
#
#-----[ REPLACE WITH ]-----------------------------------
#
$goto_page = '<br> [ <img src="' . $images['icon_gotopost'] . '" alt="' . $lang['Goto_page'] . '" title="' . $lang['Goto_page'] . '" />' . $lang['Goto_page'] . ': ';
#
#-----[ FIND ]-----------------------------------
#
'U_VIEW_TOPIC' => $view_topic_url)
);
#
#-----[ AFTER, ADD ]-----------------------------------
#
// Begin Flat Tree MOD - Walt
//
// Retreive the username, user id and the number of posts
//
$sql = "SELECT p.post_id, p.poster_id, p.post_username, p.post_time, t.post_subject, u.username
FROM " . POSTS_TABLE . " p, " . POSTS_TEXT_TABLE . " t, " . USERS_TABLE . " u
WHERE topic_id = '$topic_id'
AND p.post_id = t.post_id
AND u.user_id = p.poster_id
ORDER BY p.post_time ASC";
// CHANGE TO 0.0.2 ^ - Walt
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain topic posters information', '', __LINE__, __FILE__, $sql);
}
$reply_info = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
//FIXME: No list for moved posts.
if (count($reply_info) > 1) {
$template->assign_block_vars('topicrow.switch_replies', array() );
for ( $j = 1; $j < count($reply_info); $j++ )
{
$author_reply = $guest_reply = $view_profile_url = '';
$topic_reply = $reply_info[$j]['post_subject'];
// CHANGE TO 0.0.2 - Walt
$k = '';
if ($j >= $board_config['posts_per_page']) {
$k = $board_config['posts_per_page'] * (int) ($j / $board_config['posts_per_page']);
$k = "&start=$k";
}
if ($topic_reply == '') { $topic_reply = $lang['No_subject']; }
// CHANGE TO 0.0.3 - Walt
$topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id$k") . "#" . $reply_info[$j]['post_id'];
if ($reply_info[$j]['poster_id'] != -1)
{
$author_reply = $reply_info[$j]['username'];
$view_profile_url = append_sid($phpbb_root_path . "profile." . $phpEx . "?mode=viewprofile&u=" . $reply_info[$j]['poster_id']);
}
else // If the user is a guest, don't include a link to the profile
{
$guest_reply = ($reply_info[$j]['post_username'] == '' ? $lang['Guest'] :
$reply_info[$j]['post_username']) ;
}
$reply_time = create_date($board_config['default_dateformat'], $reply_info[$j]['post_time'], $board_config['board_timezone']);
$template->assign_block_vars('topicrow.switch_replies.replyrow', array(
'REPLY_TOPIC' => $topic_reply,
'U_REPLY_TOPIC' => $topic_url,
'REPLY_AUTHOR' => $author_reply,
'U_REPLY_AUTHOR' => $view_profile_url,
'REPLY_GUEST' => $guest_reply,
'REPLY_TIME' => $reply_time)
);
}
}
// End Flat Tree MOD - Walt
#
#-----[ OPEN ]----------------------------------------
#
templates/subSilver/viewforum_body.tpl
#
#-----[ FIND ]-----------------------------------
#
<!-- BEGIN topicrow -->
<tr>
<td class="row1" align="center" valign="middle" width="20"><img src="{topicrow.TOPIC_FOLDER_IMG}" width="19" height="18" alt="{topicrow.L_TOPIC_FOLDER_ALT}" title="{topicrow.L_TOPIC_FOLDER_ALT}" /></td>
<td class="row1" width="100%"><span class="topictitle">{topicrow.NEWEST_POST_IMG}{topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a></span><span class="gensmall"><br />
{topicrow.GOTO_PAGE}</span></td>
<td class="row2" align="center" valign="middle"><span class="postdetails">{topicrow.REPLIES}</span></td>
<td class="row3" align="center" valign="middle"><span class="name">{topicrow.TOPIC_AUTHOR}</span></td>
<td class="row2" align="center" valign="middle"><span class="postdetails">{topicrow.VIEWS}</span></td>
<td class="row3Right" align="center" valign="middle" nowrap="nowrap"><span class="postdetails">{topicrow.LAST_POST_TIME}<br />{topicrow.LAST_POST_AUTHOR} {topicrow.LAST_POST_IMG}</span></td>
</tr>
<!-- END topicrow -->
#
#-----[ REPLACE WITH ]-----------------------------
#
<!-- BEGIN topicrow -->
<tr>
<td class="row1" align="center" valign="top" width="20"><img src="{topicrow.TOPIC_FOLDER_IMG}" width="19" height="18" alt="{topicrow.L_TOPIC_FOLDER_ALT}" title="{topicrow.L_TOPIC_FOLDER_ALT}" /></td>
<td class="row1" width="100%" valign="top"><span class="topictitle">{topicrow.NEWEST_POST_IMG}{topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a></span><span class="gensmall">
{topicrow.GOTO_PAGE}
<!-- BEGIN switch_replies -->
<table cellspacing="0" cellpadding="0" width="100%" class="ftsubj">
<!-- BEGIN replyrow -->
<tr><td width="10%"> </td><td><a href="{topicrow.switch_replies.replyrow.U_REPLY_TOPIC}" class="ftsubj">{topicrow.switch_replies.replyrow.REPLY_TOPIC}</a>: <a href="{topicrow.switch_replies.replyrow.U_REPLY_AUTHOR}" class="ftauth"><b>{topicrow.switch_replies.replyrow.REPLY_AUTHOR}</b></a><span class="ftauth">{topicrow.switch_replies.replyrow.REPLY_GUEST}</span></td></tr>
<!-- END replyrow -->
</table>
<!-- END switch_replies -->
</span></td>
<td class="row2" align="center" valign="middle"><span class="postdetails">{topicrow.REPLIES}</span></td>
<td class="row3" align="center" valign="top"><span class="name">{topicrow.TOPIC_AUTHOR}</span></td>
<td class="row2" align="center" valign="top"><span class="postdetails">{topicrow.VIEWS}</span></td>
<td class="row3Right" align="center" valign="top" nowrap="nowrap"><span class="postdetails">{topicrow.LAST_POST_TIME}<br />{topicrow.LAST_POST_AUTHOR} {topicrow.LAST_POST_IMG}</span></td>
</tr>
<!-- END topicrow -->
#
#-----[ OPEN ]----------------------------------------
#
templates/subSilver/overall_header.tpl
#
#-----[ FIND ]-----------------------------------
#
.helpline { background-color: {T_TR_COLOR2}; border-style: none; }
#
#-----[ AFTER, ADD ]-----------------------------------
#
/* Flat Thread MOD: Fonts used for subject and author in reply listing in forum page */
.ftsubj,.ftauth { font-size : {T_FONTSIZE2}px; color : {T_BODY_TEXT}; text-decoration: none; }
a.ftsubj,a.ftauth { text-decoration: none; }
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Code: Select all
<!-- BEGIN topicrow -->
<tr>
<td width="100%" valign="top"><img src="{topicrow.TOPIC_FOLDER_IMG}" width="19" height="18" align="absmiddle" alt="{topicrow.L_TOPIC_FOLDER_ALT}" title="{topicrow.L_TOPIC_FOLDER_ALT}" />
<span class="topictitle">{topicrow.NEWEST_POST_IMG}{topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a></span>
- <span class="name">{topicrow.TOPIC_AUTHOR}</span>
<span class="postdetails"> <i>{topicrow.FIRST_POST_TIME}</i> ({topicrow.VIEWS} views)</span>
<span class="gensmall">{topicrow.GOTO_PAGE}</span>
<!-- BEGIN switch_replies -->
<ul class="ftsubj">
<!-- BEGIN replyrow -->
<li><a href="{topicrow.switch_replies.replyrow.U_REPLY_TOPIC}" class="ftsubj">{topicrow.switch_replies.replyrow.REPLY_TOPIC}</a> - <a href="{topicrow.switch_replies.replyrow.U_REPLY_AUTHOR}" class="ftauth"><b>{topicrow.switch_replies.replyrow.REPLY_AUTHOR}</b></a><span class="ftauth">{topicrow.switch_replies.replyrow.REPLY_GUEST}</span> <span class="postdetails"><i>{topicrow.switch_replies.replyrow.REPLY_TIME}</i></span></li>
<!-- END replyrow -->
</ul>
<!-- END switch_replies -->
</td>
</tr>
<!-- END topicrow -->