Eccomi, ho finito di editare il codice e ora lo posto fatto, finito e funzionante:
Codice da inserire in index.php o richiamato in esso tramite include:
(preferibile quest'ultima opzione)
Codice: Seleziona tutto
<?php
// MOD Topten Topics : Topics più recenti, Topics più visti e Posts più recenti
// created by Micogian (Bingo)
if (!defined('IN_PHPBB'))
{
exit;
}
// configurazione: numero dei recods da visualizzare nella Lista
$list_rec = 50 ; // numero di records da estrarre dalla tabella (alcuni topics potrebbero non aver il permesso di lettura)
$list_view = 20 ; // sostituire il numero della variabile $lista se si desidera diminuire/aumentare il numero dei Topics
//---------- 10 Ultimi posts start -----------//
$sql4 = "SELECT tt.topic_id, tt.forum_id, tt.topic_moved_id, tt.topic_last_post_id, tt.topic_last_poster_id, tt.topic_last_poster_name, tt.topic_last_post_subject, tt.topic_last_post_time,
ft.forum_id, ft.forum_name
FROM " . TOPICS_TABLE . " tt, " . FORUMS_TABLE . " ft
WHERE tt.topic_type = 0
AND tt.topic_moved_id = 0
AND tt.forum_id = ft.forum_id
ORDER BY tt.topic_last_post_time DESC LIMIT 0,$list_rec";
$result4 = $db->sql_query($sql4);
$n4 = 0;
while ($row4 = $db->sql_fetchrow($result4))
{
if ($auth->acl_get('f_read', $row4['forum_id']) == 1)
{
if ($n4 < $list_view)
{
$post_subject = str_replace("Re: ", "", $row4['topic_last_post_subject']) ;
if (strlen($post_subject) > 28)
{
$post_title = substr($post_subject,0,25) . "...";
}else{
$post_title = $post_subject ;
}
$last_post_link[$n4] = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row4['forum_id'] . "&p=" . $row4['topic_last_post_id'] . "#p" . $row4['topic_last_post_id']);
//$last_post_link[$n4] = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row4['forum_id'] . "&t=" . $row4['topic_id'] . "p#" . $row4['topic_last_post_id']);
$last_post_title[$n4] = $row4['topic_last_post_subject'];
$last_post_title_short[$n4] = $post_title;
$last_post_forum[$n4] = $row4['forum_name'];
$last_post_author[$n4] = $row4['topic_last_poster_name'];
$last_post_time[$n4] = $row4['topic_last_post_time'];
$last_post_author_link[$n4] = append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=viewprofile&u=" . $row4['poster_id']);
$last_post_forum_link[$n4] = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=" . $row4['forum_id']);
++$n4 ;
}else{
break ;
}
}
}
//---------- 10 Ultimi posts end -----------//
// Crea l'array "topten_list" che contiene le Variabili per il Template
for ($x = 0; $x < $list_view; ++$x)
{
$template->assign_block_vars('topten_list',array(
'LAST_POST_LINK' => $last_post_link[$x],
'LAST_POST_TITLE' => $last_post_title[$x],
'LAST_POST_TITLE_SHORT' => $last_post_title_short[$x],
'LAST_POST_FORUM' => $last_post_forum[$x],
'LAST_POST_AUTHOR' => $last_post_author[$x],
'LAST_POST_DATE' => date("j/n/y", $last_post_time[$x]),
'LAST_POST_TIME' => date("H:m", $last_post_time[$x]),
'LAST_POST_AUTHOR_LINK' => $last_post_author_link[$x],
'LAST_POST_FORUM_LINK' => $last_post_forum_link[$x]
));
}
?>
Codice da inserire nel template index_body.html o richiamato in esso tramite include:
(preferibile quest'ultima opzione)
Codice: Seleziona tutto
<ul id="lastmex" class="topiclist forums">
<!-- BEGIN topten_list -->
<li><span><a href="{topten_list.LAST_POST_LINK}">{topten_list.LAST_POST_TITLE}</a></span><div>
Inviato il {topten_list.LAST_POST_DATE} alle ore: {topten_list.LAST_POST_TIME}<br>Da <a href="{topten_list.LAST_POST_AUTHOR_LINK}">{topten_list.LAST_POST_AUTHOR}</a> in <a href="{topten_list.LAST_POST_FORUM_LINK}">{topten_list.LAST_POST_FORUM}</a></div></li>
<!-- END topten_list -->
<!-- Il codice per gli ultimi messaggi è stato creato editando la MOD Topten Topics: http://www.phpbbitalia.net/titania/mod/topten_topics/
Creata da Micogian (Bingo) -->
</ul>
Ne approfitto per segnalare un piccolo bug della mod topten topics relativo agli "Ultimi 10 post", o almeno, sul mio forum non funzionava:
Se il topics a cui rimandava il link aveva più di 1 pagina, si veniva indirizzati all'ultimo post della prima pagina e quindi l'ultimo post effettivo bisognava raggiungerlo "Manualmente".
Io ho risolto modificando la seguente riga:
Codice: Seleziona tutto
$last_post_link[$n4] = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row4['forum_id'] . "&t=" . $row4['topic_id'] . "#p" . $row4['topic_last_post_id']);
in questa:
Codice: Seleziona tutto
$last_post_link[$n4] = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row4['forum_id'] . "&p=" . $row4['topic_last_post_id'] . "#p" . $row4['topic_last_post_id']);
Con l'occasione ringrazio tutti per avermi aiutato, mi farò risentire presto per altri piccoli problemi e consigli
