website logo
Auteur
avatar
colonelwog

Forum » » Questions » » Sitemap


Posté : 16 mars 2025 à 15:25 icone du post

Bon j'ai remodifier mon code car pages.php ne fonctionne toujours pas pour le sitemap.xml:
[code php]function mapmodules() {
   global $NPDS_Prefix, $nuke_url;
   $tmp = '';
   
   // Exécution de la requête pour récupérer les modules
   $result = sql_query("SELECT fid, fnom FROM ".$NPDS_Prefix."fonctions WHERE fcategorie_nom='Modules' AND finterface='1' ORDER BY fnom_affich");
   
   while (list($fid, $fnom_affich) = sql_fetch_row($result)) {
      // Échappe les caractères spéciaux dans les URLs pour le XML
      $safe_url = htmlspecialchars($nuke_url."/modules.php?ModPath=".$fnom_affich."&ModStart=index", ENT_QUOTES, 'UTF-8');
      
      $tmp .= "\n";
      $tmp .= "$safe_url\n";
      $tmp .= "".date("Y-m-d",time())."\n";
      $tmp .= "weekly\n";
      $tmp .= "0.5\n";
      $tmp .= "\n\n";
   }

   // Libération du résultat SQL
   sql_free_result($result);
   
   return $tmp;
}


function sitemap_create($PAGES, $filename) {

   $ibid  ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
   $ibid .= "\n\n";" target="_blank">http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\">\n\n";
   
   if (array_key_exists('sitemap',$PAGES['article.php']))
      $ibid.=sitemaparticle($PAGES['article.php']['sitemap']);

   if (array_key_exists('sitemap',$PAGES['forum.php']))
      $ibid.=sitemapforum($PAGES['forum.php']['sitemap']);

   if (array_key_exists('sitemap',$PAGES['sections.php']))
      $ibid.=sitemaprub($PAGES['sections.php']['sitemap']);

   if (array_key_exists('sitemap',$PAGES['download.php']))
      $ibid.=sitemapdown($PAGES['download.php']['sitemap']);
  


   $ibid.=sitemapothers($PAGES);
    $ibid.=mapmodules();
   $ibid.="";

   $file=fopen($filename, "w");
   fwrite($file, $ibid);
   fclose($file);

   Ecr_Log("sitemap", "sitemap generated : ".date("H:i:s", time()), "");
}[/code]

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