Index du Forum » » Questions

Auteur

Les dix derniers posts affichés en accueil.
oim
1453       
 

  Posté : 29-08-2006 20:22

Slt, le code prend en cpte les groupes et la couleur des dossiers, on peut le mettre dans un fichier qu'on appelle dans un bloc, ou remplacer la fonction RecentForumPosts dans powerpack_f.php et l'appeler function#RecentForumPosts. Si c'est un fichier remplacer boxstuff par des echo.
//Par contre il doit être vérifié par programmeur parce que c'est moi qui l'est fait (...et c'est pas gagné)//


    global $cookie,$parse, $user, $bgcolor1, $bgcolor2, $bgcolor3,$bgcolor4, $bgcolor5, $bgcolor6;

    $maxcount=10;//Nbre de messages
    $mbid = mysql_fetch_row(mysql_query("SELECT uid FROM users WHERE uname='$cookie[1]'"));
    $rowcolor=tablos();
$boxstuff="<table cellspacing=\"3\" cellpadding=\"1\" class=\"cadre_mi\" width=\"100%\" border=\"0\"><tr align=\"center\" bgcolor=$bgcolor4>" ;
$boxstuff.="<td><b>Etat</b></td><td width=\"15%\"><b>Forum</b></td><td width=\"55%\"><b>Sujet</b></td><td width=\"20%\"><b>Date</b></td><td width=\"25%\"><b>Dernier Auteur</b></td></tr>";
    $result = mysql_query("select distinct topic_id from posts 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,forum_id from forumtopics where topic_id=$topic_id"));
    if ($forum_id!=0) list($forum_name,$forum_type,$forum_pass) = mysql_fetch_row(mysql_query("select forum_name,forum_type,forum_pass from forums where forum_id=$forum_id"));
       if (($forum_type == "5") or ($forum_type == "7")) {
          $ok_affich=false;
          $tab_groupe=valid _group($user);
          $ok_affich=groupe _forum($forum_pass, $tab_groupe);
       } else {
          $ok_affich=true;
       }
       if ($ok_affich) {
     if ($poster_id!=0) list($uname) = mysql_fetch_row(mysql_query("select uname from users where uid=$poster_id"));
$boxstuff.="<tr $rowcolor>";

   if ($ibid=theme_image("forum/icons/hot_red_folder.gif")) {$imgtmpHR=$ibid;} else {$imgtmpHR="images/forum/icons/hot_red_folder.gif";}
   if ($ibid=theme_image("forum/icons/hot_folder.gif")) {$imgtmpH=$ibid;} else {$imgtmpH="images/forum/icons/hot_folder.gif";}
   if ($ibid=theme_image("forum/icons/red_folder.gif")) {$imgtmpR=$ibid;} else {$imgtmpR="images/forum/icons/red_folder.gif";}
   if ($ibid=theme_image("forum/icons/folder.gif")) {$imgtmpF=$ibid;} else {$imgtmpF="images/forum/icons/folder.gif";};

   $sqlR = "SELECT rid FROM forum_read WHERE topicid='$topic_id' and uid='$mbid[0]' and topicid='$topic_id' and status!='0'";
   $TableRep=mysql_query("SELECT * FROM posts WHERE topic_id='$topic_id'");
   $replys=mysql_NumRows($TableRep);
   $hot_threshold=10;//Nbres sujets chauds
            if ($replys >= $hot_threshold) {
              ;  if (mysql_num_rows(mysql_query($sqlR))==0)
              ;    $image = $imgtmpHR;
              ;  else
              ;    $image = $imgtmpH;
            } else {
              ;   if (mysql_num_rows(mysql_query($sqlR))==0)
              ;      $image = $imgtmpR;
              ;  else
              ;     $image = $imgtmpF;
            }

            if&nb sp;($myrow[topic_status]!=0)
              ;  $image = $imgtmpL;
$boxstuff.="<td align=\"center\"><img src=\"$image\"></td><td>$forum_name</td><td align=\"left\">";
$boxstuff.="<a href=\"viewtopic.php?topic=$topic_id&forum=$forum_id\">$topic_title</ a></td>";
$boxstuff.="<td align=\"center\">$time</td> " ;
$boxstuff.="<td><a href=\"user.php?op=userinfo&uname=$uname\">$uname</a></td>\n ";
    }
   }
$boxstuff.="</tr></table>";
    return ($boxstuff);


P.S. : Je n'ai fait des tests quand local, vous aussi...



Cet article provient de NPDS

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