1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| $table_prefix = 'phpbb_';
$sql = "REQUETE SQL";
$result = mysql_query($sql);
// Initialisation des 2 couleur possible (lie aux CSS)
$couleur_ligne = array('postCouleur1','postCouleur2');
echo '<div class="blockHeader">Les 5 derniers topics</div>';
while($data = mysql_fetch_array($result)) {
$color = $couleur_ligne[$i % 2];
$postTitle = '<a href='.$phpbb_root_path.'viewtopic.php?t='.$data['topic_id'].'>'.$data['topic_title'].'</a>';
$date = date('d/m/y', $data['topic_time']);
$profile = '<a href="'.$phpbb_root_path.'profile.php?mode=viewprofile&u='.$data['user_id'].'">'.$data['username'].'</a>';
$comment ='<a href="'.$phpbb_root_path.'viewtopic.php?t='.$data['topic_id'].'">'.$data['topic_replies'].' commentaire(s)</a>';
echo '<div class="'.$color.'">';
echo '<p class="postTitre">'.$postTitle.'</p>';
echo '<p class="postAuteur">Post par '.$profile.' le '.$date.' - '.$comment.'</p>';
echo '</div>';
if ($i >= 5) {
break;
}
$i++;
} |
Partager