Index du Forum » » Questions

Auteur

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

  Posté : 26-08-2006 22:59

Celui-la fonctionne et prend en compte les groupes


#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=\"0\" cellpadding=\"2\" cellspacing=\"0 \"><tr align=\"center\" class=\"HEADER\">" ;
  $corps .= "<td></td><td width=\"55%\"><b>Sujet</b></td><td width=\"20%\"><b>Date</b></td><td width=\"25%\"><b>Auteur</b></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){
   $classe = tablos();
       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"));
     $corps .= "<tr align=\"center\" $classe>" ;

     $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\">";
  $corps .= " <a href=\"viewtopic.php?topic=$topic_id&amp;forum=$forum_id\">$topic_title& lt;/a></td>";
  $corps .= "<td align=\"center\">$time</td> " ;
  $corps .= "<td><a href=\"user.php?op=userinfo&amp;uname=$uname\">$uname</a></td&g t;</tr>\n";
  }
  $corps .="</table>";
  $Xcontent=extend_meta_mot($Xcontent,"!lastforums!",$corps);
  





Cet article provient de NPDS

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