Computer

Tutte le notizie aggiornate sul mondo dei Computer

Corsi

In questa sezione troverete tutti i corsi divisi per argomento

Programmazione

Tutto le novità le guide sul mondo della programmazione

Tecnologia

In questa sezione tutte le notizie riguardanti il mondo della tecnologia

Unix

In questa sezione tutte le novità, tutorial sul mondo di unix

Home » Programmazione

Mybb: inserire le ultime discussioni in home

Inserito da redazione lunedì, 31 agosto 20092 Commenti

Facciamo finta di avere un sito in PHP con Mybb integrato e vogliamo far uscire le ultime discussioni in home.php

apriamo home.php e all’inizio aggiungiamo il seguente codice

E inserite il seguente codice dove volete che appaiono le discussioni:

simple_select(TABLE_PREFIX.'threads', '*', "fid='{$fid}' ORDER BY tid DESC LIMIT {$limit}");
if($db->num_rows($query) > 0)
{
while($row = $db->fetch_array($query))
{
$query2 = $db->simple_select(TABLE_PREFIX.'posts', '*', "pid='{$row['firstpost']}'");
$row2 = $db->fetch_array($query2);

$date = my_date($mybb->settings['dateformat'], $row2['dateline'], "", 1);
$time = my_date($mybb->settings['timeformat'], $row2['dateline'], "", 1);

$options = array(
'allow_html' => 'no',
'filter_badwords' => 'yes',
'allow_mycode' => 'yes',
'allow_smilies' => 'yes',
'nl2br' => 'yes',
'me_username' => 'yes'
);
$message = $parser->parse_message($row2['message'], $options);

echo("{$row['subject']} -
Inviato da: {$date} {$time} by {$row2['username']}
");
echo("{$message}

");
echo("Rispondi ({$row['replies']})


");
}
}
else
{
echo 'Nessuna Notizia.';
}

?>

Ora vi basta modificare $fid = 2 con l’ID del forum da dove prendere le ultime discussioni e modificare $limit = 5 con il limite massimo di ultime discussioni da vedere.

Saluti,
Michele

Popularity: 2% [?]

2 Commenti »

  • SoundJohn detto da:

    Thanx for this beautiful place in internet!!!

  • Unselstailt detto da:

    Hi.
    My computer worked slowly, too much errors. Help me, please to fix buggs on my PC.
    I used Windows 2003.
    Thx,
    Unselstailt

Lascia la tua risposta!

Aggiungi il tuo commento qui sotto. Puoi anche iscriverti a questi commenti via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

Si possono usare anche questi tag:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Questo è un blog che usa Gravatar. Per ottenere il tuo gravatar, , si prega di registrarsi presso Gravatar.