Phpbb3 : ultimi post in homepage

Problemi con il migliore csm per forum gratuito ?
Autore Messaggio
 Oggetto del messaggio: Phpbb3 : ultimi post in homepage
MessaggioInviato: mar nov 20, 2007 6:19 pm 
Avatar utente
Non connesso
Founder
Founder

Iscritto il: gio ago 09, 2007 11:35 am
Messaggi: 1302
Località: Roma
Partendo da un codice trovato qui sono riuscito a visualizzare sulla homepage del sito gli ultimi post del forum !

il codice è il seguente :

Codice: Seleziona tutto
<?
            //------------------------------
        //Edit these parameters:
        //MySQL server adress
        $host="localhost";
        //Username
        $user="username";
        //Password
        $pass="password";
        //Database
        $db="my_database";
        //Table prefix
        $table="phpbb3_";
        //Show last x topics
        $laforums="6";
        $link=mysql_connect($host, $user, $pass);
        $db=mysql_select_db($db);
//------------------------------se avete delle sezioni protette mettete l'id corrispondente alla voce forum_id !='id forum' altrimenti cancellate le parti and forum_id !='2' and forum_id !='21'
        $query="select * from $table".topics."  WHERE topic_approved = '1' and forum_id !='2' and forum_id !='21' order by topic_last_post_time desc limit 0,$laforums";
        $query2="select config_name,config_value from $table".config." where config_name = 'server_name' limit 0,1";
        $result2=mysql_query($query2);
        $row2 = mysql_fetch_array($result2);
        extract($row2);
      $posts_per_page = $r3[1];
        $result=mysql_query($query);
        while ($row=mysql_fetch_array($result)) {
        extract($row);
        $date = date("F j, Y, g:i a", $topic_last_post_time );
//------------------------------se avete delle sezioni protette mettete l'id corrispondente alla voce forum_id !='id forum' altrimenti cancellate le parti and forum_id !='2' and forum_id !='21'
        $query3="select forum_name from $table".forums." WHERE forum_id = ".$forum_id." and forum_id !='2' and forum_id !='21'";
        $result3=mysql_query($query3);
        $row2 = mysql_fetch_array($result3);
//Edit the folder name of your forum
                echo "<a href='http://".$config_value."/forum/viewforum.php?f=".$forum_id."' target='_blank'>".$row2[forum_name].":</a> <a href='http://".$config_value."/forum/viewtopic.php?f=".$forum_id."&t=".$topic_id."&p=".$topic_last_post_id."#p".$topic_last_post_id."' target='_blank'>".$topic_title."</a> view: ".$topic_views.", replies: ".$topic_replies.", topic first poster: ".$topic_first_poster_name.", topic last poster: ".$topic_last_poster_name.", topic last post time: ".$date."<br>\n";
      }
        //-------------------------- END
    ?>

_________________
Immagine
Immagine

Immagine


Profilo
 WWW E-mail  
 
Visualizza ultimi messaggi:  Ordina per  

Chi c’è in linea

Visitano il forum: Nessuno e 1 ospite