Visualizzazione risultati 1 fino 4 di 4

Discussione: Ultime dal forum in home page...

  1. #1
    Guest

    Predefinito Ultime dal forum in home page...

    Salve! Qualcuno sa dirmi se è possibile creare una cosa simil php-nuke per vedere gli ultimi messaggi postati nel forum su un "blocco" in home page?
    Semplicemente modificando il codice del vero e proprio block per nuke credete sia possibile ottenere lo stesso risultato?

    p.s NON voglio utilizzare nuke o altri cms prefatti

  2. #2
    Guest

    Predefinito

    dipende dal forum che usi

  3. #3
    L'avatar di funcool
    funcool non è connesso Utente storico
    Data registrazione
    05-02-2004
    Residenza
    Qui... Non lì, qui!
    Messaggi
    15,433

    Predefinito

    Usa phpBB...
    Mattia vi manda a FunCool - Matriz - Directory Gogol - Sfondo rosso per la Birmania
    «Tu mi dai fastidio perché ti credi tanto un Dio!» «Bè, dovrò pur prendere un modello a cui ispirarmi, no?» Woody Allen

  4. #4
    Guest

    Predefinito

    ho modificato lo script in questo modo:
    Codice:
    <?php
    
    /* Database */
    $dbhost = "localhost";
    $dbuname = "";
    $dbpass = "";
    $db_name = "";
    
    /* Tables */
    
    $prefix = "phpbb_";
    $user_prefix = "phpbb_";
    
    $db = mysql_connect($dbhost, $dbuname, $dbpass, $dbname);
    
    $sitename = "";
    $bgcolor1 = "#FF00FF";
    $bgcolor2 = "#FF0000";
    
    
    /**********************************/
    /*                                */
    /* Configuration parameters       */
    /*                                */
    /**********************************/
    // When set to 1 then Forums permissions which View and/or Read are NOT set to 'ALL' will NOT be displayed in the center block
    $HideViewReadOnly = 1;
    // Show only 5 last new topics
    $Last_New_Topics  = 5;                            
    // Icon that is displayed in Center Block in front of Topic
    $IconPath         = "phpBB2/templates/subSilver/images/icon_mini_message.gif";
    
    /**********************************/
    /*                                */
    /* Don't Edit Below !             */
    /*                                */
    /**********************************/
    $border           = 0;
    $cellspacing      = 0;
    $cellstyle        = "style=\"border-left-width: 1; border-right-width: 1; border-top-width: 1; border-bottom-style: dotted; border-bottom-width: 1\"";
    
    /* Total Amount of Topics */
    $query 	= "SELECT * FROM ".$prefix."topics";
    $result = mysql_query($query,$db);
    $Amount_Of_Topics = mysql_num_rows($result);
    
    /* Total Amount of Posts */
    $query 	= "SELECT * FROM ".$prefix."posts";
    $result = mysql_query($query,$db);
    $Amount_Of_Posts = mysql_num_rows($result);
    
    /* Total Amount of Topic Views */
    $Amount_Of_Topic_Views = 0;
    $query = "SELECT topic_views FROM ".$prefix."topics";
    $result = mysql_query($query,$db);
    $row = mysql_fetch_row($result);
    while(list($topic_views) = $row);
    {
       $Amount_Of_Topic_Views = $Amount_Of_Topic_Views + $topic_views;
    }
    
    /* Total Amount of Topic Replies */
    $Amount_Of_Topic_Replies = 0;
    $query 	= "SELECT topic_replies FROM ".$prefix."topics";
    $result = mysql_query($query,$db);
    $row 	= mysql_fetch_row($result);
    while(list($topic_replies) = $row)
    {
       $Amount_Of_Topic_Replies = $Amount_Of_Topic_Replies + $topic_replies;
    }
    
    /* Total Amount of Members */
    $query 	= "SELECT * FROM ".$prefix."users";
    $result = mysql_query($query,$db);
    $Amount_Of_Members = mysql_num_rows($result) - 1;
    
    /* Last X New Topics */
    $Count_Topics = 0;
    $Topic_Buffer = "";
    $query = "SELECT topic_id, forum_id, topic_last_post_id, topic_title, topic_poster, topic_views, topic_replies, topic_moved_id FROM ".$prefix."topics ORDER BY topic_last_post_id DESC";
    $result1 = mysql_query($query,$db);
    while( list( $topic_id, $forum_id, $topic_last_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $topic_moved_id ) = mysql_fetch_row( $result1, $db ) )
    {
       $skip_display = 0;
       if( $HideViewReadOnly == 1 )
       {
          $query = "SELECT auth_view, auth_read FROM ".$prefix."forums where forum_id = '$forum_id'";
          $result5 = mysql_query($query,$db);
          $row = mysql_fetch_row($result5);
          
          list( $auth_view, $auth_read ) = $row;
          if( ( $auth_view != 0 ) or ( $auth_read != 0 ) ) { $skip_display = 1; }
       }
       
       if( $topic_moved_id != 0 )
       {
    	  // Shadow Topic !!
          $skip_display = 1;
       }
       
       if( $skip_display == 0 )
       {
    	  $Count_Topics += 1;
    	  $query = "SELECT topic_id, poster_id, FROM_UNIXTIME( post_time,'%b %d, %Y at %T') as post_time FROM ".$prefix."posts where post_id = '$topic_last_post_id'";
    	  $result2 = mysql_query($query,$db);
    	  $row = mysql_fetch_row($result2);
    	  
          list( $topic_id, $poster_id, $post_time ) = $row;
    	  
    	  $query = "SELECT username, user_id FROM ".$prefix."users where user_id='$poster_id'";
    	  $result3 = mysql_query($query,$db);
    	  $row = mysql_fetch_row($result3);
          list( $uname, $uid ) = $row ;
         
          $LastPoster = "<A HREF=\"modules.php?name=Forums&file=profile&mode=viewprofile&u=$uid\"STYLE=\"text-decoration: none\"> $uname </a>";
          
          $query = "SELECT username, user_id FROM ".$prefix."users where user_id='$topic_poster'";
    	  $result4 = mysql_query($query,$db);
    	  $row = mysql_fetch_row($result4);
          list( $uname, $uid ) = $row ;
          
          $OrigPoster = "<A HREF=\"phpBB2/profile.php?mode=viewprofile&u=$uid\"STYLE=\"text-decoration: none\"> $uname </a>";
       
          $TopicImage = "<img src=\"$IconPath\" border=\"0\" alt=\"\">";
          $TopicTitleShow = "<a href=\"phpBB2/viewtopic.php?p=$topic_last_post_id#$topic_last_post_id\"STYLE=\"text-decoration: none\">$topic_title</a>";
       
          $Topic_Buffer .= "<tr height=20 onmouseover=\"this.style.backgroundColor='#eeeeee'\" onmouseout=\"this.style.backgroundColor=''\"><td $cellstyle>$TopicImage&nbsp;&nbsp;</td><td $cellstyle>$TopicTitleShow</td><td $cellstyle><div align=\"center\">$OrigPoster</div></td><td $cellstyle><div align=\"center\"><b>$topic_views</b></div></td><td $cellstyle><div align=\"center\"><b>$topic_replies</b></div></td><td $cellstyle align=\"center\">$LastPoster<br><font size=\"-2\"><i>$post_time</i></font></td></tr>";
       }
       
       if( $Last_New_Topics == $Count_Topics ) { break 1; }
       
    }
    
    /* Write Table to Screen */
    $content  = "<table width=\"100%\" border=\"$border\"  cellspacing=\"$cellspacing\" bordercolor=\"$bgcolor2\" bgcolor=\"$bgcolor1\">";
    $content .= "<tr><td height=\"21\" align=\"center\" colspan=\"6\" bgcolor=\"$bgcolor2\"><b>$sitename</b></td></tr>";
    $content .= "<tr><td>&nbsp;&nbsp;</td><td align=\"center\">Nuovi messaggi</td><td align=\"center\">Autori</td><td align=\"center\">Visti</td><td align=\"center\">Risposte</td><td align=\"center\">Ultimi posts</td></tr>";
    $content .= "$Topic_Buffer";
    $content .= "<tr><td align=\"center\" colspan=\"6\">Messaggi:<b>$Amount_Of_Topics</b>&nbsp;<b>|</b>&nbsp;Posts:<b>$Amount_Of_Posts</b>&nbsp;<b>|</b>&nbsp;Visti:<b>$Amount_Of_Topic_Views</b>&nbsp;<b>|</b>&nbsp;Risposte:<b>$Amount_Of_Topic_Replies</b>&nbsp;<b>|</b>&nbsp;<a href=\"phpBB2/memberlist.php\">Utenti:</a>&nbsp;<b>$Amount_Of_Members</b></center></td></tr>";
    $content .= "<tr><td align=\"center\" colspan=\"6\">[ <a href=\"phpBB2/index.php\">Vai al forum</a> ]&nbsp;&nbsp;&nbsp;[ <a href=\"phpBB2/search.php\">Cerca</a> ]</center></td></tr>";
    $content .= "</table>";
    echo "$content";
    ?>
    Non ricevo errori nè warnings, le query, se eseguite direttamente nel database funzionano... ma nonostante questo vedo la tabella ma non viene scritto nessun post... qualcuno sa aiutarmi?

Regole di scrittura

  • Non puoi creare nuove discussioni
  • Non puoi rispondere ai messaggi
  • Non puoi inserire allegati.
  • Non puoi modificare i tuoi messaggi
  •