j'ai effectué un exemple qui répertorie les urls
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
<div class="main col-md-8 space-bottom">
<p class="lead">Plan du site web </p>
<ul class="menu">
<?php
include_once('administration/script/connect.php');
$req=$bdd->query('SELECT * FROM ville ORDER BY ID_ville ');
while($ville = $req->fetch())
{
?>
<li ><a href="http://www.xxx.fr/informatique-<?php echo ($ville['short_url']);?>.php">http://www.xxx.fr/informatique-<?php echo ($ville['short_url']);?>.php</a><br /></li><br />
<li ><a href="https://www.xxx.fr/installation-reseau-informatique-<?php echo ($ville['short_url']);?>.php">https://www.xxx.fr/installation-reseau-informatique-<?php echo ($ville['short_url']);?>.php</a><br /></li>
<?php
}
$req->closeCursor();
?>
</ul>
</div> |
je vais me pencher sur ta méthode
Donc je me suis basé sur les info que tu ma données
je créer un fichier nommé generator.php
en reprenant ton code
je ne comprend pas cette ligne :
require(dirname(__DIR__).'/'.REP_MODULE_ART_ARTICLES.'/_config/boot_fct_basic.php');
voici en modifiant ton code, j'analyse combien il y a de ville
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
<?php
'<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
';
// -----------------
// MENUS
$SITEMAP .= generate_sitemap_mainMenu();
// -----------------
// ARTICLES
$SITEMAP .= generate_sitemap_short_url();
// -----------------
$SITEMAP .= '</urlset>';
// -----------------
$fp = fopen(dirname(__DIR__).'sitemaps/sitemap.xml', 'w+'); // w+ : crée le fichier si il n'existe pas
fputs($fp, $SITEMAP);
fclose($fp); // On ferme le fichier
// -------------------------------------------------------------
// short_url
// -------------------------------------------------------------
function generate_sitemap_short_url(){
// -----------------
require(dirname(__DIR__).'/'.REP_MODULE_ART_ARTICLES.'/_config/boot_fct_basic.php');
// -------------------------------------------------------------
$SITEMAP = '';
foreach( $_SESSION[SITE_URL_WWW]['SHORT_URL']['SITE_array'] as $SHORT_URL)
{
$ville_query = "SELECT * FROM ville ORDER BY ID_ville";
try {
$pdo_select = $pdo->prepare($ville_query);
$pdo_select->execute();
$ville_nombre = $pdo_select->rowCount();
$ville_rowAll = $pdo_select->fetchAll();
} catch (PDOException $e){ echo 'Erreur SQL : '. $e->getMessage().'<br/>'; die(); }
if( $ville_nombre>0)
{
foreach( $ville_rowAll as $ville_row)
{
$shot_url = (!empty($ville_row['shot_url_']))?
$ville_row['shot_url'] : $ville_row['shot_url'.$_SESSION[SITE_URL_WWW]['BD_main']];
$ville_pageURL = formatage_nom_fichier($shot_url);
$PRIORITY = '0.7';
$SITEMAP .=
' <url>
<loc>'.SITE_URL_HTTP.'/'.$ville_row['shot_url'].'.php'.'</loc>
<priority>'.$PRIORITY.'</priority>
</url>
';
}
}
}
return $SITEMAP;
};
?> |
lorsque je lance le fichier j'obtiens
Fatal error: Call to undefined function generate_sitemap_mainMenu() in /home/mbifroojmc/www/generator.php on line 7
Partager