
guess what! I found my code from the previous version.. for B5
this is to change to recent posts instead of recent topics...
(plus it will give you more information to show, like # of views & posts & poster name etc...)
Open root/bb3portal/blocks/recent.php
find:
- Code: Select all
$sql_where .= ' AND forum_id != ' . trim($id);
Add AFTER:
- Code: Select all
$recent_where .= ' AND phpbb_topics.forum_id != ' . trim($id);
(note: this is needed because of the joins... there may be a better way.. but hey, this works! lol)
Find:
- Code: Select all
//
// Recent topic (only show normal topic)
//
$sql = 'SELECT topic_title, forum_id, topic_id
FROM ' . TOPICS_TABLE . '
WHERE topic_status <> 2
AND topic_approved = 1
AND topic_type = 0
' . $sql_where . '
ORDER BY topic_time DESC';
REPLACE WITH:
- Code: Select all
//
// Recent Posts(only show normal posts)
//
$sql = "SELECT topic_title, phpbb_topics.forum_id, topic_id, topic_first_poster_name, topic_last_poster_name, topic_last_post_time,
forum_name, topic_views, topic_replies, REPLACE(icons_url,'misc/','misc/r') as icon_url
FROM " . TOPICS_TABLE . " LEFT JOIN phpbb_forums ON phpbb_topics.forum_id = phpbb_forums.forum_id
LEFT JOIN phpbb_icons ON phpbb_topics.icon_id = phpbb_icons.icons_id
WHERE topic_status <> 2
AND topic_approved = 1
" . $recent_where . "
ORDER BY topic_last_post_time DESC";
Find After Above code: (its the last assign_block_vars)
- Code: Select all
$template->assign_block_vars('latest_topics', array(
'TITLE' => character_limit($row['topic_title'], $CFG['recent_title_limit']),
'FULL_TITLE' => censor_text($row['topic_title']),
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id'])
)
REPLACE WITH:
- Code: Select all
$template->assign_block_vars('latest_topics', array(
'TITLE' => character_limit($row['topic_title'], $CFG['recent_title_limit']),
'FULL_TITLE' => censor_text($row['topic_title']),
'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']),
'TOPIC_STARTER' => $row['topic_first_poster_name'],
'TOPIC_LASTPOSTBY' => $row['topic_last_poster_name'],
'TOPIC_LASTPOSTTIME' => $user->format_date($row['topic_last_post_time']),
'FORUM_NAME' => $row['forum_name'],
'T_VIEWS' => $row['topic_views'],
'T_REPLIES' => $row['topic_replies'],
'T_ICON' => isset($row['icon_url']) ? '<img src="http://staticfx.com/forums/images/icons/' . $row['icon_url'] . '" align="absmiddle" />' : '',
'F_ID' => $row['forum_id']
)
Now open root/style/{STYLENAME}/templates/bb3portal/blocks/recent.html
FIND:
- Code: Select all
<!-- BEGIN latest_topics -->
<a href="{latest_topics.U_VIEW_TOPIC}" title="{latest_topics.FULL_TITLE}">{latest_topics.TITLE}</a><br />
<!-- END latest_topics -->
and change to whatever you want... use each of the variable listed to create your display
Mine looks like this now (actually with a ton more changes to it , like expand on click etc...)
but it should at least show you how to use the different variables....
- Code: Select all
<!-- BEGIN latest_topics -->
<tr style="background-color: rgb(58,68,79);">
<td class="row1" valign="top">
<a href="{latest_topics.U_VIEW_TOPIC}&view=unread#unread" title="{latest_topics.FULL_TITLE}">{latest_topics.TITLE}</a> {latest_topics.T_ICON}
<br />
</td>
<td class="row1" valign="top">
{latest_topics.T_VIEWS}
</td>
<td class="row1" valign="top">
{latest_topics.T_REPLIES}
</td>
<td class="row1" valign="top">
<a href="http://staticfx.com/forums/viewforum.php?f={latest_topics.F_ID}">{latest_topics.FORUM_NAME}</a>
</td>
<td class="row1" valign="top">
{latest_topics.TOPIC_LASTPOSTBY}
</td>
<td class="row1" valign="top" align="center">
{latest_topics.TOPIC_LASTPOSTTIME}
</td>
</tr>
<!-- END latest_topics -->
to view a working sample:
http://forums.staticfx.com/click on the Recent Topic link
ENJOY!