Elenco ultimi topic aperti e ultimo topic risposto in Homepage
-
-
fabio.fp
alcune cose:
- il file non deve essere necessariamente .php giusto ? io ce l'ho .html anche perchè la mia home page è in xhtml.
Ma certo che SI
Deve essere .php! 
Ora si spiega tutto, prima cosa rinomina l'estensione della pagina da .html in .php!
Poi, una volta scelto dove far comparire i 5 nuovi topic, nel codice sorgente della tua pagina scrivi:
<?phpe a seguire tutto il codice che avevo postato io!
e concludi con:?>Prova, semmai ci sarà forse qualche piccolo ritocco. Facci sapere.
-
-
Ciao Fabio.fp
prova così<?php $database = mysql_connect("host", "username", "password"); mysql_select_db("nomedatabase"); $sql="SELECT * FROM phpbb_topics WHERE forum_id!=2 ORDER BY topic_id DESC LIMIT 5;"; $risultati=mysql_query($sql,$database); while($riga=mysql_fetch_array($risultati)) { $target=$riga["topic_title"]; $target1=$riga["topic_id"]; $target3=$riga["topic_poster"]; $sqlDUE="SELECT * FROM phpbb_users WHERE user_id='".$target3." LIMIT 1;'"; $risultato=mysql_query($sqlDUE,$database); $valori = mysql_fetch_array ($risultato); $nick = $valori['username']; echo ' <tr>'; echo '<td style="text-align:center; border:1px solid white;"> <a href="http://www.links4you.it/phpBB2/viewtopic.php?t='.$target1.'"><img src="forum/templates/subSilver/images/folder_new_hot.gif" width="18" height="20" border="0"></a><a href="http://www.links4you.it/phpBB2/viewtopic.php?t='.$target1.'" title="">'.$target.'</a> (proposto da <a href="phpBB2/profile.php?mode=viewprofile&u='.$valori['user_id'].'">'.$nick.'</a>)</td> '; echo ' </tr>'; } ?> -
-
-
-
Ho provato anch'io ad adoperare il codice che hai postato, Jantima.
Il forum sta in root/phpBB3/ mentre lo script.php sta in root.
Ho adattato il codice così, ma quando eseguo la pagina nel browser non appare nulla.<?php $database = mysql_connect("localhost", "username", "pass"); mysql_select_db("databasename"); $sql="SELECT * FROM phpbb3_topics WHERE forum_id!=2 ORDER BY topic_id DESC LIMIT 5;"; $risultati=mysql_query($sql,$database); while($riga=mysql_fetch_array($risultati)) { $target=$riga["topic_title"]; $target1=$riga["topic_id"]; $target3=$riga["topic_poster"]; $sqlDUE="SELECT * FROM phpbb3_users WHERE user_id='".$target3." LIMIT 1;'"; $risultato=mysql_query($sqlDUE,$database); $valori = mysql_fetch_array ($risultato); $nick = $valori['username']; echo ' <tr>'; echo '<td style="text-align:center; border:1px solid white;"> <a href="http://sito.it/phpBB3/viewtopic.php?t='.$target1.'"><img src="http://sito.it/phpBB3/styles/prosilver/imageset/sticky_unread.gif" width="18" height="20" border="0"></a><a href="http://sito.it/phpBB3/viewtopic.php?t='.$target1.'" title="">'.$target.'</a> (proposto da <a href="http://sito.it/phpBB3/profile.php?mode=viewprofile&u='.$valori['user_id'].'">'.$nick.'</a>)</td> '; echo ' </tr>'; } ?>Dove username, pass e databasename sono nome utente del database, password e nome del database. E' su Altervista.
-
Ciao a tutti, ho provato il codice di zanardi e ho pulito alcune cosette, questa versione è funzionante (potete vedere qui)
Questo è il codice:mysql_connect("localhost", "bd_user","db_pass") or die("The page is currently going through some major updates and will be back soon."); mysql_select_db("db_name") or die("Unable to connect to database"); $sql="SELECT * FROM phpbb_topics WHERE forum_id!=2 ORDER BY topic_id DESC LIMIT 5"; $risultati=mysql_query($sql); echo '<table>'; while($riga=mysql_fetch_array($risultati)) { $target=$riga["topic_title"]; $target1=$riga["topic_id"]; $target3=$riga["topic_poster"]; $sqlDUE="SELECT * FROM phpbb_users WHERE user_id='".$target3." LIMIT 1;'"; $risultato=mysql_query($sqlDUE); $valori = mysql_fetch_array ($risultato); $nick = $valori['username']; echo '<tr>'; echo '<td><a href="http://www.TUODOMINIO.it/forum/viewtopic.php?t='.$target1.'"><img src="http://www.TUODOMINIO.it/forum/viewtopic.php?t='.$target1.'"><img src="forum/templates/subSilver/images/common/folder_new_hot.gif" width="18" height="20" border="0"></a><a href="http://www.TUODOMINIO.it/forum/viewtopic.php?t='.$target1.'" title="">'.$target.'</a> (proposto da <a href="forum/profile.php?mode=viewprofile&u='.$valori['user_id'].'">'.$nick.'</a>)</td>'; echo '</tr>'; } echo '</table>';Per chi volesse anche un estratto del post insieme alla lista dei posts, recenti ho messo insieme un codice prelevato dal RSS feed.
Questa la pagina esempio
e questo il codice:<? mysql_connect("localhost", "bd_user","db_pass") or die("The page is currently going through some major updates and will be back soon."); mysql_select_db("db_name") or die("Unable to connect to database"); $sql = "SELECT topic_id, MAX(post_time) post_time FROM phpbb_posts WHERE forum_id IN (1, 3, 4, 5, 6, 9, 13, 14, 11, 16, 18, 19, 20, 21) GROUP BY topic_id ORDER BY post_time DESC LIMIT 0,15"; $results=mysql_query($sql); ?> <a href="http://www.antiworld.biz"><h2>Recent Topics From the CTF Forums</h2></a> <? while($row=mysql_fetch_array($results)) { $sql2 = " SELECT t.topic_title, f.forum_name,pt.post_text, t.topic_replies, u.username, p.post_time, p.post_id FROM phpbb_posts p, phpbb_users u, phpbb_forums f, phpbb_topics t, phpbb_posts_text pt WHERE p.post_time = ".$row['post_time']." AND p.topic_id = ".$row['topic_id']." AND p.poster_id = u.user_id AND p.forum_id = f.forum_id AND p.topic_id = t.topic_id AND pt.post_id = p.post_id"; $results2=mysql_query($sql2); $row2=mysql_fetch_array($results2); //t.topic_type $username=$row2["username"]; $topic_title=$row2["topic_title"]; $post_id=$row2["post_id"]; $forum_name=$row2["forum_name"]; $post_time=$row2["post_time"]; $topic_replies=$row2["topic_replies"]; $text = $row2["post_text"]; ?> <a href="http://www.antiworld.biz/antiworld/viewtopic.php?p=<?=$post_id?>"> <h4><?=$topic_title?></h4></a> <?=substr($text,0,200)?> <br /> <strong>Autore:</strong> <?=$username?> <strong>Pubblicato il:</strong> <?=date("D, d M Y G:i O",$post_time)?><br /> <? } ?>Vi ricordo inoltre topics anywhere, è uno strumento utile per creare un javascript o dei RSS che mostrno gli ultimi posts e metterli in qualsiasi pagina in qualsiasi sito. (il mio è visibile qui). Il risultato ottenuto con topics anywhere sta nella home del sito sotto a "Recent Topics From the CTF Forums"
Ho anche altri scriptini usati in passato per fare la lista degli ultimi topics.
Questo è uno molto molto semplice che lista solo i titoli (visibile qui)<? include('db_connect.php'); // if you want to exclude any forums just add the id to the NOT IN (.......) $sql = "SELECT * FROM phpbb_posts_text pt LEFT JOIN phpbb_posts p ON pt.post_id = p.post_id WHERE pt.post_subject!='' AND p.forum_id NOT IN (2,7,8,15) ORDER BY pt.post_id DESC LIMIT 0,50"; $results=mysql_query($sql); while($row=mysql_fetch_array($results)) { $target=$row["post_subject"]; $target1=$row["post_id"]; echo "<a href=\"http://www.antiworld.biz/antiworld/viewtopic.php?p=$target1\" title=\"\">$target</a><br>"; } ?>Questo è un altro, visibile qui
<? include('db_connect.php'); $sql = "SELECT topic_id, MAX(post_time) post_time FROM phpbb_posts WHERE forum_id IN (1, 3, 4, 5, 6, 9, 13, 14, 11, 16, 18, 19, 20, 21) GROUP BY topic_id ORDER BY post_time DESC LIMIT 0,15"; $results=mysql_query($sql); while($row=mysql_fetch_array($results)) { $sql2 = " SELECT t.topic_title, f.forum_name, t.topic_replies, u.username, p.post_time, p.post_id FROM phpbb_posts p, phpbb_users u, phpbb_forums f, phpbb_topics t WHERE p.post_time = ".$row['post_time']." AND p.topic_id = ".$row['topic_id']." AND p.poster_id = u.user_id AND p.forum_id = f.forum_id AND p.topic_id = t.topic_id"; $results2=mysql_query($sql2); $row2=mysql_fetch_array($results2); //t.topic_type $username=$row2["username"]; $topic_title=$row2["topic_title"]; $post_id=$row2["post_id"]; $forum_name=$row2["forum_name"]; $post_time=$row2["post_time"]; $topic_replies=$row2["topic_replies"]; ?> <a href="http://www.antiworld.biz/antiworld/viewtopic.php?p=<?=$post_id?>" title="<?=$topic_title?>"><?=$topic_title?></a> in <?=$forum_name?> (<?=$topic_replies?> Replies) - <?=$username?>, <?=$post_time?><br> <? } ?> -
-
salve a tutti e complimenti x la community!

veniamo a noi, questi script vanno bene x phpBB3 ?
grazie
Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.
Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.
Con il tuo contributo, questo post potrebbe essere ancora migliore 💗
Registrati Accedi

