Plugin di cache non funzionanti
-
Ho inserito questo codice nella mia homepage:
<? error_reporting(E_ALL); include("forum/config.php"); $sql="SELECT * FROM phpbb_topics WHERE forum_id!=15 ORDER BY topic_id DESC LIMIT 20"; $risultati=mysql_query($sql); while($riga=mysql_fetch_assoc($risultati)) { $target=$riga["topic_title"]; $target1=$riga["topic_id"]; echo" <a href=\"http://www.miosito.it/forum/viewtopic.php?t=$target1\" title=\"\">$target</a> "; } ?>Ma non si vede niente.
Nemmeno un errore...niente di niente di niente di niente.
Ho provato a fare anche una pagina vuota con dentro solo questo codice e non si vede niente di niente.
Come mai??? -
-
Strano, mi posti l'altro script?

-
<?php $topicnumber = 10; $urlPath = "http://forum.miosito.it"; $phpbb_root_path = './forum/'; define('IN_PHPBB', true); include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); $table_topics = $table_prefix. "topics"; $table_forums = $table_prefix. "forums"; $table_posts = $table_prefix. "posts"; $table_users = $table_prefix. "users"; $query = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time FROM $table_topics t, $table_forums f, $table_posts p, $table_users u WHERE t.topic_id = p.topic_id AND f.forum_id = t.forum_id AND t.topic_status <> 2 AND p.post_id = t.topic_last_post_id AND p.poster_id = u.user_id ORDER BY p.post_id DESC LIMIT $topicnumber"; $result = mysql_query($query) or die("Query failed"); print ""; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "<a href=\"$urlPath/viewtopic.php?topic=$row[topic_id]\"></a> <a href=\"$urlPath/viewtopic.php?topic=$row[topic_id]\">" . $row["topic_title"] . "</a>[/b]" . $row["username"] . ""; } print ""; mysql_free_result($result); ?>Io ho usato questo codice. Teoricamente è sbagliato perché ho cancellato un po' di cose affinché mostri solo il nome del topic ma alcune informazioni le prende lo stesso ma non le fa vedere. Tipo la riga $row["username"] non posso cancellarla e non capisco perché.
-
Se un topic ha un titolo troppo lungo, come fare a far comparire tre puntini "..." dopo tot lettere ?
una cosa del genere
if (strlen($topic_title)>27) { $topic_title = substr($topic_title,0,24) . '...'; }che però non so adattare al mio codice
<? $ris_query = "SELECT topic_poster, topic_id, topic_title, username FROM phpbb_topics INNER JOIN phpbb_users ON topic_poster = user_id WHERE forum_id!=10 AND forum_id!=9 ORDER BY topic_time DESC LIMIT 7"; $db = mysql_connect("xxxxx","xxxxx","xxxxx"); $res = mysql_db_query("xxxxx",$ris_query) or die('errore'); $num_righe = mysql_num_rows($res); ?> <? if($num_righe > 0) { ?> <table border="0" cellpadding="0" cellspacing="0"> <? $i = 0; while($i < $num_righe) { $topic_id = mysql_result($res,$i,"topic_id"); $topic_title = mysql_result($res,$i,"topic_title"); $username = mysql_result($res,$i,"username"); $topic_poster = mysql_result($res,$i,"topic_poster"); echo "<tr>"; echo "<td><a href=\"http://www.tuosito.com/forum/viewtopic.php?t=$topic_id\" target=\"_blank\" title=\"$topic_title\" class='link_2'>$topic_title</td>"; echo "</tr>"; echo "<tr>"; echo "<td>posted by: <a href=\"http://www.tuosito.com/forum/profile.php?mode=viewprofile&u=$topic_poster\" target=\"_blank\" title=\"$username\" class='link_2'>$username</td>"; echo "</tr>"; echo "<tr>"; echo "<td></td>"; echo "</tr>"; $i++; } ?> </table> <? } else echo "Nessun topic presente"; ?>Grazie !
-
-
Basta che le metti subito dopo che assegni la variabile:
<? $ris_query = "SELECT topic_poster, topic_id, topic_title, username FROM phpbb_topics INNER JOIN phpbb_users ON topic_poster = user_id WHERE forum_id!=10 AND forum_id!=9 ORDER BY topic_time DESC LIMIT 7"; $db = mysql_connect("xxxxx","xxxxx","xxxxx"); $res = mysql_db_query("xxxxx",$ris_query) or die('errore'); $num_righe = mysql_num_rows($res); ?> <? if($num_righe > 0) { ?> <table border="0" cellpadding="0" cellspacing="0"> <? $i = 0; while($i < $num_righe) { $topic_id = mysql_result($res,$i,"topic_id"); $topic_title = mysql_result($res,$i,"topic_title"); if (strlen($topic_title)>27) $topic_title = substr($topic_title,0,24) . '...'; $username = mysql_result($res,$i,"username"); $topic_poster = mysql_result($res,$i,"topic_poster"); echo "<tr>"; echo "<td><a href=\"http://www.tuosito.com/forum/viewtopic.php?t=$topic_id\" target=\"_blank\" title=\"$topic_title\" class='link_2'>$topic_title</td>"; echo "</tr>"; echo "<tr>"; echo "<td>posted by: <a href=\"http://www.tuosito.com/forum/profile.php?mode=viewprofile&u=$topic_poster\" target=\"_blank\" title=\"$username\" class='link_2'>$username</td>"; echo "</tr>"; echo "<tr>"; echo "<td></td>"; echo "</tr>"; $i++; } ?> </table> <? } else echo "Nessun topic presente"; ?> -
-
-
vision82
Ciao, piccola domanda da profano....ho provato lo script funziona perfettamente ma il problema che mi visualizza anche i post che vengono scritti nell'area dei moderatori, come faccio ad escludere quei post?
SPero non sia troppo banale

Mi auto quoto, qualcuno sa rispondere?
-
Ciao vision82.
Cerca nel tuo script questo pezzo di codiceuser_id WHERE forum_id!=0e prova ad aggiungere
AND forum_id!=xdove x sarà il numero ID della sezione moderatori sul tuo forum.
Il codice finale sarà qualcosa del tipo:
user_id WHERE forum_id!=0 AND forum_id!=x
-
-
-
-
alive
giorgio tu ce l'hai sul tuo sito, ci metti due sec a rispondermi
per favore !Si ovvio

Solamente che mi è sfuggito questo topic, ogni tanto salto qualche forum da leggere.
Metti al posto del LIMIT 10
LIMIT 11, 100
Prova
-
-
-
-
-
Ok! Comincio a capire!
Ho fatto un file .php con dentro questo codice:<?
error_reporting(E_ALL);
echo "WOW !!!";
mysql_connect("localhost", "[Utente]", "[password]");
mysql_select_db("phpbb");$sql="SELECT * FROM phpbb_posts_text WHERE post_subject!='' ORDER BY post_id DESC LIMIT 10";
$risultati=mysql_query($sql);
while($riga=mysql_fetch_array($risultati)) {
$target=$riga["post_subject"];
$target1=$riga["post_id"];
echo"<a href="http://www.terminillo.org/viewtopic.php?p=$target1\" title="">$target</a>
";
}//Fine del while
?>ma mi mostra solo la scritta "WOW!!!"
Please, HELP ME! Dove sbaglio ora?Tarivor
Scusate, è il mio primo post, e faccio una domanda sicuramente molto stupida in quanto non so nulla di php.
Ma che vuol dire mettere quel codice in homepage? Se non dentro un html, dove non funziona, dove?
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