petit probleme avec mon sitemap.xml
3 messages • Page 1 sur 1
Consultez la formation au référencement naturel Google de WebRankInfo / Ranking Metrics
petit probleme avec mon sitemap.xml
hello
j'ai un petit probleme avec mon sitemap.xml (php)
il genere bien mes url en xml mais le bleme il n'est pas accepte par google
de ce fait je dois copier le code source des url en xml dans un fichier xml pour quil soit digeré par google
a tout hazard je donne la source de la page php de mon generateur de sitemap , y a peut etre un truc qui cloche ^^
j'ai un petit probleme avec mon sitemap.xml (php)
il genere bien mes url en xml mais le bleme il n'est pas accepte par google
de ce fait je dois copier le code source des url en xml dans un fichier xml pour quil soit digeré par google
a tout hazard je donne la source de la page php de mon generateur de sitemap , y a peut etre un truc qui cloche ^^
- Code: Tout sélectionner
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
function make_url_friendly($url)
{
$url = strtolower($url);
$find = array(' ',
'"',
'&',
'\r\n',
'\n',
'/',
'\\',
'+',
'<',
'>');
$url = str_replace ($find, '-', $url);
$find = array('é',
'è',
'ë',
'ê',
'É',
'È',
'Ë',
'Ê');
$url = str_replace ($find, 'e', $url);
$find = array('í',
'ì',
'î',
'ï',
'Í',
'Ì',
'Î',
'Ï');
$url = str_replace ($find, 'i', $url);
$find = array('ó',
'ò',
'ô',
'Ó',
'Ò',
'Ô');
$url = str_replace ($find, 'o', $url);
$find = array('ö',
'Ö');
$url = str_replace ($find, 'oe', $url);
$find = array('á',
'à',
'â',
'Á',
'À',
'Â');
$url = str_replace ($find, 'a', $url);
$find = array('ä',
'Ä');
$url = str_replace ($find, 'ae', $url);
$find = array('ú',
'ù',
'û',
'Ú',
'Ù',
'Û');
$url = str_replace ($find, 'u', $url);
$find = array('ü',
'Ü');
$url = str_replace ($find, 'ue', $url);
$find = array('ß');
$url = str_replace ($find, 'ss', $url);
$find = array('/[^a-z0-9\-<>]/',
'/[\-]+/',
'/<[^>]*>/');
$repl = array('',
'-',
'');
$url = preg_replace ($find, $repl, $url);
$url = str_replace ('--', '-', $url);
return $url;
}
//
// Start session management
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
// End session management
//
$script_name = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($board_config['script_path']));
$server_name = trim($board_config['server_name']);
$server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
$server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';
$server_url = $server_protocol . $server_name . $server_port . $script_name;
if(substr($server_url, -1, 1) != "/")
{
$server_url .= "/";
}
$template->set_filenames(array("body" => "sitemap_body.tpl"));
$template->assign_vars(array(
'BOARD_URL' => $server_url)
);
//Get a list of publicly viewable forums
//Thanks to Kieran007 for supplying the sql for this
$sql = "SELECT forum_id FROM ". FORUMS_TABLE ." WHERE auth_read=0";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error getting permissions', '', __LINE__, __FILE__, $sql);
}
$ids = $db->sql_fetchrowset($result);
$row = 0;
while($row <= count($ids) -1)
{
$forumids .= $ids[$row]['forum_id'].",";
$row ++;
}
$forumids = substr($forumids, 0, strlen($forumids)-1);
if($board_config['sitemap_sort'] == "ASC")
{
$order = "DESC";
}
else
{
$order = "ASC";
}
$sql = "SELECT topic_id FROM " . TOPICS_TABLE . " WHERE forum_id IN (" . $forumids . ") ORDER BY topic_id $order LIMIT 1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error getting topic information', '', __LINE__, __FILE__, $sql);
}
$result = $db->sql_fetchrow($result);
$lastid = $result['topic_id'];
//only get a limited number of topics per query (default 250) to keep server load down in case of large boards
while($lasttopic != $lastid)
{
$result = "";
//Newest topics first
if(is_numeric($lasttopic) && $board_config['sitemap_sort'] == "ASC")
{
$lasttopic++;
$wheresql = "AND t.topic_id >= $lasttopic";
}
//Oldest topics first
elseif(is_numeric($lasttopic))
{
$lasttopic--;
$wheresql = "AND t.topic_id <= $lasttopic";
}
else
{
$wheresql = "";
}
$sql = "SELECT t.topic_id, t.topic_title, t.topic_type, t.topic_status, p.post_time FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p WHERE t.topic_last_post_id=p.post_id AND t.forum_id IN (" . $forumids . ") $wheresql ORDER BY t.topic_id " . $board_config['sitemap_sort'] . " LIMIT " . $board_config['sitemap_topic_limit'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error obtaining topic data', '', __LINE__, __FILE__, $sql);
}
$topics = $db->sql_fetchrowset($result);
$db->sql_freeresult();
foreach ($topics as $topic)
{
switch ($topic['topic_type'])
{
case 2:
$topic_priority = $board_config['sitemap_announce_priority'];
break;
case 1:
$topic_priority = $board_config['sitemap_sticky_priority'];
break;
default:
$topic_priority = $board_config['sitemap_default_priority'];
}
if ($topic['topic_status'] == 1)
{
$topic_change = "never";
}
else
{
$topic_change = "always";
}
$template->assign_block_vars('topics', array(
//'TOPIC_URL' => $server_url."viewtopic.$phpEx?t=" . $topic['topic_id'],
'TOPIC_URL' => $server_url. str_replace ('--', '-', make_url_friendly($topic['topic_title']) . "-vt" . $topic['topic_id'] . ".html"),
'TOPIC_TIME' => gmdate('Y-m-d\TH:i:s'.'+00:00', $topic['post_time']),
'TOPIC_PRIORITY' => $topic_priority,
'TOPIC_CHANGE' => $topic_change
)
);
$lasttopic = $topic['topic_id'];
}
}
//Compresss the sitemap with gzip
//this isn't as pretty as the code in page_header.php, but it's simple & it works :)
if(function_exists(ob_gzhandler) && $board_config['gzip_compress'] == 1)
{
ob_start(ob_gzhandler);
}
header("Content-type: text/xml");
$template->pparse('body');
?>
-

Boby Night - Nouveau WRInaute
- Messages: 36
- Inscription: Mar Avr 18, 2006 9:03
- Code: Tout sélectionner
//Compresss the sitemap with gzip
//this isn't as pretty as the code in page_header.php, but it's simple & it works :)
if(function_exists(ob_gzhandler) && $board_config['gzip_compress'] == 1)
{
ob_start(ob_gzhandler);
}
header("Content-type: text/xml");
$template->pparse('body');
?>
Tu compresses ton fichier en gzip ?
3 messages • Page 1 sur 1
Formation recommandée sur ce thème :
Formation Référencement naturel Google : apprenez une méthode efficace pour optimiser à fond le référencement naturel dans Google de façon durable... Formation animée par Olivier Duffez et Fabien Facériès, experts en référencement naturel.
Tous les détails sur le site Ranking Metrics : programme, prix, dates et lieux, inscription en ligne.
Lectures recommandées sur ce thème :
- Contraintes d'emplacement du Sitemap
- Déclarer son fichier sitemap dans le fichier robots.txt
- Comment gérer simplement les sitemaps de plusieurs sites au même endroit
- Où placer son fichier Sitemap ? A la racine ?
- Google Sitemap Generator version 1.3
- Exalead rejoint le protocole Sitemaps.org
- Référencement de vidéos avec les fichiers sitemaps vidéo
- Google Enterprise a son blog
- Nouvelle version de Yahoo Site Explorer (août 2008)
- Ecrire un sitemap pour Google News
Consultez la description détaillée des produits ou services de Google suivants : Google Sitemaps, API Google Checkout
Qui est en ligne
Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 0 invités


le forum