

// Output page
page_header($user->lang['INDEX']);
// Output page
ORDER BY topic_views DESC LIMIT 0,5
<?php
// INIZIO - Topic più Visto -- by carlino1994
$sql = "SELECT topic_id, forum_id, topic_title FROM " . TOPICS_TABLE . " ORDER BY topic_views DESC LIMIT 0,5";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
if ($auth->acl_get('f_read', $row['forum_id']) == 1) {
$template->assign_block_vars('topicvisto', array(
'LINK' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row['forum_id'] . "&t=" . $row['topic_id']),
'TITOLO' => $row['topic_title'])
);
}
}
$db->sql_freeresult($result);
// FINE
?>include($phpbb_root_path . 'mod_tviews.' . $phpEx);
LIMIT 0,5
<?php
// INIZIO - Topic più Visto -- by carlino1994
$nrec = 10; // numero dei records da estrarre
$ntop = 5 ; // numero dei topics da visualizzare
$sql = "SELECT topic_id, forum_id, topic_title FROM " . TOPICS_TABLE . " ORDER BY topic_views DESC LIMIT 0,$nrec";
$result = $db->sql_query($sql);
n = '0' ;
while ($row = $db->sql_fetchrow($result))
{
if ($auth->acl_get('f_read', $row['forum_id']) == 1) {
if ( $n < $ntop )
{
$template->assign_block_vars('topicvisto', array(
'LINK' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row['forum_id'] . "&t=" . $row['topic_id']),
'TITOLO' => $row['topic_title'])
);
++$n ;
}
}
}
$db->sql_freeresult($result);
// FINE
?>
$ntop, puoi inserire un break in modo tale che il ciclo venga terminato, e non continui fino a quando non ha estratto tutti gli argomenti.
Carlo ha scritto:Esatto. Un piccolo consiglio.
Quando il ciclo while() ha mostrato il numero di argomenti definiti in$ntop, puoi inserire un break in modo tale che il ciclo venga terminato, e non continui fino a quando non ha estratto tutti gli argomenti.

10 topics più visti phpbb gli argomenti piu visitati il topic piu visitati mod topic più visti phpbb phpbb cambiare descrizione a più argomenti phpbb topic piu visti topic più visitati i topic piu' argomenti topic
Visitano il forum: Nessuno e 1 ospite
