Index du Forum » » Questions

Auteur

Les dix derniers posts affichés en accueil.
leloup31
1994       
 

  Posté : 28-08-2006 22:06

essaye celui-la ça ira mieux


autodoc !lastforums! : Affihce les X derniers posts des forums avec un icone correspondant à lu/non-lu
   $maxcount = "10"; //Remplacez le nombre par le nombre de sujets que vous voulez afficher
   global $cookie;
   $mbid = mysql_fetch_row(mysql_query("SELECT uid FROM users WHERE uname='$cookie[1]'"));
   $corps = "<table width=\"100%\" border=1 bordercolor=$bgcolor4 cellpadding=2 cellspacing=0 bgcolor=$bgcolorblock><tr align=center bgcolor=$bgcolor2>" ;
   $corps .= "<td></td><td width=55%><font size=2><b>Sujet</b></font></td><td width=20%><font size=2><b>Date</b></font></td><td width=25%><font size=2><b>Auteur</b></font></td></tr>";
    $result = mysql_query("select distinct topic_id from posts where forum_id!=13 order by post_id desc limit $maxcount");
    if (!$count) $count = mysql_num_rows($result);
    if ($count>$maxcount)$count=$maxcount;
    $ibid=0;
    $forum_limit=0;
    while ($forum_limit<$count){
        list($topic_id) = mysql_fetch_row($result);
        list($post_id, $forum_id, $poster_id, $time) = mysql_fetch_row(mysql_query("select post_id, forum_id, poster_id, post_time from posts where topic_id = $topic_id order by post_id desc limit 1"));
      $forum_limit++;
      if ($topic_id!=0) list($topic_title) = mysql_fetch_row(mysql_query("select topic_title from forumtopics where topic_id=$topic_id"));
       if ($poster_id!=0) list($uname) = mysql_fetch_row(mysql_query("select uname from users where uid=$poster_id"));
      if ($ibid==0) {
          $ibid=1;
         $bcolor=$bgcolor1;
      } else {
         $ibid=0;
         $bcolor=$bgcolor3;
      }
      $corps .= "<tr align=center bgcolor=$bcolor>" ;
$p="ph";
$h="p";
      $sqlR = "SELECT rid FROM forum_read WHERE topicid='$topic_id' and uid='$mbid[0]'";
      if ($replys >= $hot_threshold) {
          if ((mysql_num_rows(mysql_query($sqlR))== 0)) { $image = "images/forum/icons/hot_red_folder.gif"; }
         else { $image = "images/forum/icons/hot_folder.gif"; }
      } else {
          if (mysql_num_rows(mysql_query($sqlR))==0) { $image = "images/forum/icons/red_folder.gif"; }
         else { $image = "images/forum/icons/folder.gif"; }
         if ($myrow[topic_status] == 1) { $image = "images/forum/icons/lock.gif"; }
      }
   $corps .= "<td><img src=\"$image\"><td align=left><font size=2 face=\"tahoma,$site_font\" color=$textcolor1>";
   $corps .= " <a href=\"viewtopic.".$p.$h."?topic=$topic_id&forum=$forum_id\">$topic_titl e</ a></font></td>";
   $corps .= "<td align=center><font size=1 face=\"tahoma,$site_font\" color=$textcolor1>$time</font></td> " ;
   $corps .= "<td><font size=2 face=\"tahoma,$site_font\" color=$textcolor1><a href=\"user.".$p.$h."?op=userinfo&uname=$uname\">$uname</a></fo nt> </td></font></tr>";
   }
   $corps .="</table>";
   $Xcontent=extend_meta_mot($Xcontent,"!lastforums!",$corps);






Cet article provient de NPDS

http://www.npds.org/viewtopic.php?topic=21018&forum=9