website logo
Auteur
avatar
rockandsnow74

Forum » » Questions » » metamot


Posté : 9 déc. 2012 à 22:25 icone du post

Sous evolution, j'ai fait ça:


function MM_LastHistoria ($arg) {
   $lugar=1;
   $content="";

   $arg = arg_filter($arg);

   $xtab=news_aff("libre","WHERE topic=8 order by sid DESC limit 0, ".$arg*2,0,$arg*2);
   $story_limit=0;
   while (($story_limit<$arg) and ($story_limit<sizeof($xtab))) {
      $rowcolor = tablos();
      list($sid, $catid, $aid, $title, $time, $hometext, $bodytext, $comments, $counter) = $xtab[$story_limit];
      $story_limit++;
      if($counter>0) {
        $content.="<li><a href=\"article.php?sid=$sid\" class=\"noir\">".aff_langue($title)."</a>";
         $lugar++;
     }
   }
   return($content);
}


Après dans un bloc, je peux afficher les derniers articles:
LastHistoria (8); 8 étant la catégorie de l'article
Ce bout de machin est certainement perfectible.
En limitant à 1, tu devrais obtenir le dernier.

Message édité par : developpeur / 10-12-2012 00:22


Cet article provient de NPDS
https://www.npds.org/viewtopic.php?topic=25668&forum=9