Visualizzazione dei risultati da 1 a 10 su 10
  1. #1

    [phpBB2] Link agli ultimi posts in home

    Salve gente, vorrei creare nella home page un collegamento agli ultimi posts del mio forum, ospitato come il sito su altervista. Un esempio a cui rifarmi sarebbe: Lauryn.it

    Come si fa?
    Per aspera ad astra

  2. #2
    Codice PHP:
    $i 0;
        
    $result $db->ExecQuery("SELECT * FROM forum_posts_text ORDER BY post_id DESC LIMIT 5");
         while (
    $post $db->FetchArray($result""))
         {
             
    $result1 $db->ExecQuery("SELECT * FROM forum_posts WHERE post_id='{$post['post_id']}'");
             
    $top $db->FetchArray($result1"");
             
             if (
    $post['post_subject'] != "")
             {
                 
    $topics[$i]['title'] = $post['post_subject'];
                 
    $topics[$i]['text'] = substr($post['post_text'], 050)."...";
                 
                 
    $topics[$i]['id'] = $top['topic_id'];
                 
    $i++;
             }
             
         } 
    questo mette in un array gli ultimi post......poi l'array te lo sistemi a tuo piacemento secondo le tue necessità.....ciao

  3. #3
    Inserendo
    codice:
    <?php 
    $i = 0; 
        $result = $db->ExecQuery("SELECT * FROM forum_posts_text ORDER BY post_id DESC LIMIT 5"); 
        while ($post = $db->FetchArray($result, "")) 
        { 
            $result1 = $db->ExecQuery("SELECT * FROM forum_posts WHERE post_id='{$post['post_id']}'"); 
            $top = $db->FetchArray($result1, ""); 
             
            if ($post['post_subject'] != "") 
            { 
                $topics[$i]['title'] = $post['post_subject']; 
                $topics[$i]['text'] = substr($post['post_text'], 0, 50)."..."; 
                 
                $topics[$i]['id'] = $top['topic_id']; 
                $i++; 
            } 
             
        }
    ?>
    nell'arrary mi appare:
    Fatal error: Call to a member function on a non-object in /membri/smsforfree/kiko/post.php on line 83
    Cosa c'è che non va? E poi nello script non dovrebbe esserci qlc riferimento ai parametri del db su cui è ospitato il forum? :master:
    Per aspera ad astra

  4. #4
    Aiutoooooo...
    Per aspera ad astra

  5. #5
    Azz..in IE ed Opera mi ha scombinato tutta la pagina quel codice, in FF appare la scritta *Query failed*. Gaurdate
    Per aspera ad astra

  6. #6
    http://smsforfree.altervista.org/phpBB2/

    Mi spieghi una cosa..in quel codice php devo modificare qlc o posso incollarlo come lo hai postato tu?
    Per aspera ad astra

  7. #7
    dovresti modificare le funzione di mysql .... visto che io là usavo la mia classe per i db......non ci ho fatto caso quando ti ho postato il codice che avevo scritto......


    ciao

  8. #8
    Originariamente inviato da spyre
    dovresti modificare le funzione di mysql...
    What's? Io di tabelle, query, ecc.. non ne capisco una mazza!
    Per aspera ad astra

  9. #9
    Grazie, tutto risolto! Sai cosa mi fregava? Avevo messo
    codice:
    $phpbb_root_path = './phpBB2/';
    al posto di
    codice:
    $phpbb_root_path = '../phpBB2/';
    Di nuovo grazie mille..
    Per aspera ad astra

  10. #10
    Ciao,

    ho trovato questa discussione che ha risolto il mio problema (avere gli ultimi post in homepage) grazie a luigi.amorfini...

    Avrei però una piccola richiesta per luigi.amorfini:

    Lo script che hai postato crea una lista così:

    XXX inserito da YYYY il ZZ/ZZ/ZZ

    come aggiungere anche il nome del forum?

    XXX inserito da YYYY il ZZ/ZZ/ZZ postato in KKKKK

    Il campo della tabella è forum_title!!!

    Grazie
    "Quando si mangia il formaggio svizzero, che succede ai buchi?" (B. Brecht)

    Visitate il mio sito:
    www.clamorosalcibali.it

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.