Tale mod permette l'inserimento degli ultimi 10 post in ordine di tempo in una tabella.
Bisognava creare il file mod_last_topiclist.php e poi copiarlo nella root del sito con questo contenuto
Codice: Seleziona tutto
<?php
// ##### Mod Last_TopicList - Lista ultimi Topics - created by Micogian #####
$sql = "SELECT
tp.post_id, tp.topic_id, tp.forum_id, tp.post_subject, tp.post_time, tp.poster_id,
tt.topic_id, tt.forum_id, tt.topic_title, tt.topic_time, tt.topic_views, tt.topic_replies, tt.topic_poster, tt.topic_first_poster_name, tt.topic_first_poster_colour,
tt.topic_last_poster_id, tt.topic_last_poster_name, tt.topic_last_poster_colour, tt.topic_last_post_time, tt.topic_moved_id,
tf.forum_id, tf.forum_name,
tu.user_id, tu.username, tu.user_colour
FROM " . TOPICS_TABLE . " tt, " . POSTS_TABLE . " tp, " . FORUMS_TABLE . " tf, " . USERS_TABLE . " tu
WHERE tp.poster_id = tu.user_id
AND tp.forum_id = tf.forum_id
AND tp.topic_id = tt.topic_id
ORDER BY tp.post_time DESC LIMIT 0,40";
$result = $db->sql_query($sql);
$n_post = 0 ;
$lista_topics = '' ;
while ($row = $db->sql_fetchrow($result))
{
if ($auth->acl_get('f_read', $row['forum_id']) == 1) {
if( strpos($lista_topics, $row['topic_id']) == '0' AND $n_post < 10 ){
if (strlen($row['topic_title'] > '80'))
{
$topic_title_cor = substr($row['topic_title'],0,79) . "...";
}else{
$topic_title_cor = $row['topic_title'];
}
$template->assign_block_vars('last_topiclist', array(
'TOPIC_LINK' => "{$phpbb_root_path}viewtopic.$phpEx" . "?t=" . $row['topic_id'] . "&p=" . $row['post_id'] . "&#p" . $row['post_id'],
'TOPIC_TITLE' => $topic_title_cor ,
'FORUM_LINK' => "{$phpbb_root_path}viewforum.$phpEx" . '?f='.$row['forum_id'],
'FORUM_NAME' => $row['forum_name'],
'TOPIC_VIEWS' => $row['topic_views'],
'TOPIC_REPLIES' => $row['topic_replies'],
'LAST_POST_TIME' => date("d.m.Y, H:i",$row['topic_last_post_time']),
'LAST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour'])
));
$lista_topics .= "," . $row['topic_id'] ;
$n_post = ++$n_post ;
}
}
}
// ##### END Mod Last_TopicList - Lista ultimi Topics - created by Micogian #####
?>
Codice: Seleziona tutto
<div class="forabg">
<div class="inner"><span class="corners-top"><span></span></span>
<ul class="topiclist">
<li class="header">
<dl>
<dt style="text-align: left; width: 42%;"> Ultimi Topics</dt>
<dd style="text-align: left; width: 17%;"> Nome del Forum</dd>
<dd style="text-align: center; width: 6%;"> {L_REPLIES}</dd>
<dd style="text-align: center; width: 6%;"> {L_VIEWS}</dd>
<dd style="text-align: center; width: 17%;"> Ultimo Messaggio</dd>
<dd style="text-align: right;"> Data</dd>
</dl>
</li>
</ul>
<!-- BEGIN last_topiclist -->
<ul class="topiclist forums">
<li class="row">
<dl>
<dt style="text-align: left; width: 42%;"><a href="{last_topiclist.TOPIC_LINK}"><b>{last_topiclist.TOPIC_TITLE}</b></a></dt>
<dd style="text-align: left; width: 17%;"><a href="{last_topiclist.FORUM_LINK}"><span style="color:#0066FF"><b>{last_topiclist.FORUM_NAME}</b></dd>
<dd style="text-align: center; width: 6%">{last_topiclist.TOPIC_REPLIES}</dd>
<dd style="text-align: center; width: 6%;">{last_topiclist.TOPIC_VIEWS}</dd>
<dd style="text-align: center; width: 17%;"><b>{last_topiclist.LAST_AUTHOR_FULL}</b></dd><span style="color:#0066FF"><dd style="text-align: right;">{last_topiclist.LAST_POST_TIME}</dd>
</dl>
</li>
</ul>
<!-- END last_topiclist -->
<span class="corners-bottom"><span></span></span>
</div>
</div>
<br />
bisogna poi aprire il file index.php nella root trovare
Codice: Seleziona tutto
// Output page
Codice: Seleziona tutto
include($phpbb_root_path . 'mod_last_topiclist.' . $phpEx);
ultimo passo: andare nella cartella template del tema,trovare e aprire index_body.html,trovare
Codice: Seleziona tutto
<!-- INCLUDE forumlist_body.html -->
Codice: Seleziona tutto
<!-- INCLUDE mod_last_topiclist_body.html -->
Vorrei chiedere all'amico bingo: e possibile creare una seconda tabella in un altro punto dell'index del forum,che comprenda gli ultimi 5 topic solo di una sezione del forum?