Odchudzone:
[phpbb]
########################################################
## Mod Title: The last Five and the Five popular (answers/views) on index.php
## Mod Version: 1.0.0
## Author: Andrey Politov aka Sergeant <
andypolv@mail.ru >
##
## Modifyed by: FB-ke <
wacky_hacky@hotmail.com >
##
## Description: Adds small table (3 columns) on the top of the forum index with 5 last posts, 5 popular
## (with maximum answers) and 5 popular (with maximum views). It helps to provide easy access to the last topics
## and keep on the top interesting topics. You can see example of this Mod:
http://playland.ru/forum/
##
##
## Installation Level: Easy
## Installation Time: 5 Minutes
## Files To Edit: 3
## index.php
## templates/subSilver/index_body.tpl
## language/lang_english/lang_main.php
##
##
## Included Files: none
##
########################################################
##
## Before Adding This hack To Your Forum,
## You Should Back Up All Files Related To This hack
##
########################################################
##
## Installation Notes:
##
## Follow the steps below.
##
########################################################
#
#-----[ FIND IN index.php ]-----------------------------------------
#
//
// Okay, let's build the index
//
for($i = 0; $i < $total_categories; $i++)
{
$cat_id = $category_rows[$i]['cat_id'];
#
#-----[ ADD BEFORE ]------------------------------
#
//
// Okay, let's build the topic recent and popular
//
$active_topics_sql = "SELECT t.topic_id,t.topic_title, t.topic_replies, t.topic_last_post_id, p.post_time
FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . FORUMS_TABLE. " f
WHERE t.topic_last_post_id = p.post_id
AND u.user_id = p.poster_id
AND f.forum_id = t.forum_id
AND f.auth_view = 0
ORDER BY topic_last_post_id DESC
LIMIT 0,5";
if( !$active_topics = $db->sql_query($active_topics_sql))
{
message_die(GENERAL_ERROR, 'Could not retrieve recent topics', '', __LINE__, __FILE__, $active_topics_sql);
}
$recent_row = array();
while( $row = $db->sql_fetchrow($active_topics) )
{
$recent_row[] = $row;
}
$template->assign_vars(array(
'L_TOPICSRECENT' => $lang['TopicsRecent'])
);
for( $i = 0; $i < 5; $i++ )
{
$recent_topic_title = $recent_row[$i]['topic_title'];
if( strlen($recent_topic_title) > 40 )
{
$recent_topic_title = substr($recent_topic_title, 0, 40) . '...';
}
$recent_post = '<a href="viewtopic.php?' . POST_TOPIC_URL . '=' . $recent_row[$i]['topic_id'] . '" title="' . $recent_row[$i]['topic_title'] . '">' . $recent_topic_title . '</a>';
$template->assign_block_vars('topicrecentpopular', array(
'TOPICSRECENT' => $recent_post)
);
}
#
#-----[ FIND IN index.php ]------------------------------
#
'L_TOPICS' => $lang['Topics'],
#
#-----[ ADD AFTER ]------------------------------
#
'L_TOPICSRECENT' => $lang['TopicsRecent'],
#
#-----[ SAVE & CLOSE index.php ]------------------------------
#
#
#-----[ FIND IN templates/subSilver/index_body.tpl ]------------------------------
#
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<th colspan="2" class="thCornerL" height="25" nowrap="nowrap">&{L_FORUM}&</th>
<th width="50" class="thTop" nowrap="nowrap">&{L_TOPICS}&</th>
<th width="50" class="thTop" nowrap="nowrap">&{L_POSTS}&</th>
<th class="thCornerR" nowrap="nowrap">&{L_LASTPOST}&</th>
</tr>
<!-- BEGIN catrow -->
#
#-----[ ADD BEFORE ]------------------------------
#
<table width="70%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<th width="100%" class="thTop" nowrap="nowrap">&{L_TOPICSRECENT}&</th>
</tr>
<!-- BEGIN topicrecentpopular -->
<tr>
<td width="100%" class="row2" align="left" valign="middle"><span class="gensmall">{topicrecentpopular.TOPICSRECENT}</span></td>
</tr>
<!-- END topicrecentpopular -->
</table>
&
#
#-----[ SAVE & CLOSE templates/subSilver/index_body.tpl ]------------------------------
#
#
#-----[ FIND IN language/lang_english/lang_main.php ]------------------------------
#
$lang['Topics'] = 'Topics';
#
#-----[ ADD AFTER ]------------------------------
#
$lang['TopicsRecent'] = 'Najnowsze posty';
#
#-----[ SAVE & CLOSE language/lang_english/lang_main.php ]------------------------------ [/phpbb]