[ Solved ] Google reports an error in Sitemap.php

Discussion about the Google Search Engine. SEO, PageRank, AdSense, AdWords, Use and other Services.

Moderator: Moderators

[ Solved ] Google reports an error in Sitemap.php

Postby Peter77 » Fri Jun 23, 2006 4:07 pm

Hello, dcz I'm getting this error from Google:

Error
Leading whitespace


Detail
We've detected that your Sitemap file begins with whitespace. We've accepted the file, but you may want to remove the whitespace so that the file adheres to the XML standard. [?]


I'm not sure what it's talking about. there are no spaces between <? and ?>


Code: Select all
<?php
/***************************************************************************
*                             sitemap.php
*                            -------------------
*   begin                : Saturday, Feb 20, 2006
*   copyright            : (C) dcz
*   Contact              : www.phpbb-seo.com
*
*   $Id: sitemap.php,  v1.0.0RC2 2006/04/26 18:05:13 fds Exp $
*
*
***************************************************************************/

/***************************************************************************
*
*   This program is free software; you can redistribute it and/or modify
*   it under the terms of the GNU General Public License as published by
*   the Free Software Foundation; either version 2 of the License, or
*   (at your option) any later version.
*
***************************************************************************/

//mxBB PORTAL
if ( file_exists('mx_forum.php') )
{
   define( 'IN_PORTAL', true );
   $mx_root_path = './';
   $module_root_path2 = $module_root_path = 'modules/';
   include($mx_root_path . 'extension.inc');
   include($mx_root_path . 'common.'.$phpEx);
   // Start session management
   $userdata = session_pagestart($user_ip, PAGE_INDEX);
   mx_init_userprefs($userdata);
   // End session management   
   $phpbb = FALSE;
   
   define('GGSITEMAP_TABLE', $mx_table_prefix.'ggsitemap_config');
}
// PHPBB
else
{
   define('IN_PHPBB', true);
   $phpbb = TRUE;
   // YOU HAVE TO SET THE CORRECT PATH FOR PHPBB IF YOU WANT
   // TO USE THIS  SITEMAP SYSTEM OUTSIDE OF THE PHPBB FOLDER
   // AND TO LOOK AT LINE 70 too ;-)
   $module_root_path2 = $module_root_path = $phpbb_root_path = './';
   include($phpbb_root_path . 'extension.inc');
   include($phpbb_root_path . 'common.'.$phpEx);
   // Start session management
   $userdata = session_pagestart($user_ip, PAGE_INDEX);
   init_userprefs($userdata);
   // End session management
}

// Good old heavy method. Do this here to allow for sitemap installation at the root level
$script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['script_path']));
$server_name = trim($board_config['server_name']);
$server_protocol = 'http://'; // No https here, since it's ment for google Bots
$server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) . '/' : '/';
$root_url = $server_protocol . $server_name . $server_port;
$server_url = $root_url . $script_name;
if(substr($server_url, -1, 1) != "/")
{
   $server_url .= "/";
}

// Comment this line if you put your sitemap in the root folder
// and phpbb installed in a subfolder.
$root_url = ($phpbb) ? $server_url : $root_url;


//
// Include common module stuff...
//
include($module_root_path . 'mx_ggsitemaps/includes/common_GGsitemaps.' . $phpEx);


// Grab ggsitemaps config
$sql = "SELECT * FROM " . GGSITEMAP_TABLE;
if( !$result = $db->sql_query($sql) )
{
   mx_sitemaps_message_die(GENERAL_ERROR, "Couldn't get Google sitemaps config information", "", __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result) )
{
   $ggsitemap_config[$row['config_name']] = $row['config_value'];
}
// Even this is too much to stay for nothing
$db->sql_freeresult($result);

// Set some usefull vars
$sql_limit = $ggsitemap_config['sitemap_sql_limit'];
$url_limit = $ggsitemap_config['sitemap_url_limit'];
$sitemap_ver = $ggsitemap_config['sitemap_ver'];
$C_info = $ggsitemap_config['sitemap_c_info'];
$Rewrite_sitemap = ( $ggsitemap_config['sitemap_rewrited'] == "TRUE" ) ? TRUE : FALSE;
$is_index = false;
$started = false;
$query_ok = TRUE;

// Since echo is the fast way here, let's define headers and footers
// Those are inteded to allow validation
//Sitemaps
// DO NOT REMOVE (C) INFOS !!!
$S_header = '<?xml version=\'1.0\' encoding=\'UTF-8\'?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84
   http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">
<!--   Generated by mx Google Sitemaps ' . $sitemap_ver . ' - ' . $C_info . ' -->' . "\n";
$S_footer = '</urlset>';
//Sitemap index
// DO NOT REMOVE (C) INFOS !!!
$I_header = '<?xml version=\'1.0\' encoding=\'UTF-8\'?>
<sitemapindex xmlns="http://www.google.com/schemas/sitemap/0.84"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84
   http://www.google.com/schemas/sitemap/0.84/siteindex.xsd">
<!--   Generated by mx Google Sitemaps ' . $sitemap_ver . ' - ' . $C_info . ' -->' . "\n";
$I_footer = '</sitemapindex>';

// Load sitemaps, I know this mean that all module are included here
// even if they end not being asked for, but what is the cost of
// even a dozen $_GET performed in several includes for a page that's
// not supposed to be even loaded ten times a day?
$location = $module_root_path . 'mx_ggsitemaps/includes';

$dir = @opendir( $location );

while( $file = @readdir($dir) )
{
   if( preg_match("/^sitemap_.*?\." . $phpEx . "$/", $file) )
   {
      include_once($location . '/' . $file);
   }
}
@closedir($dir);

// Check if nobody tricked us
if ($started)
{
   mx_sitemaps_redirect(append_sid("index.$phpEx"));
}
// Nothing matched so it's an index
elseif (!$started)
{
   $is_index = true;

   // Load sitemap index
   $dir = @opendir( $location );

   while( $file = @readdir($dir) )
   {
      if( preg_match("/^index_.*?\." . $phpEx . "$/", $file) )
      {
         include_once($location . '/' . $file);
      }
   }
   @closedir($dir);
}
// End output if necessary
if ($started)
{
   echo $I_footer;
   exit;
}
// Never know who might have tricked us ;-)
else
{
   mx_sitemaps_message_die(GENERAL_MESSAGE, 'Invalid request');
   
}
?>
Last edited by Peter77 on Mon Jul 03, 2006 3:44 am, edited 1 time in total.
Peter77
phpBB SEO Team
phpBB SEO Team
 
Posts: 532
Joined: Wed May 10, 2006 9:46 am

Advertisement

Postby dcz » Fri Jun 23, 2006 4:45 pm

Actually, it is strange, because your sitemapIndex is actually not showing up properly, even though the source code is correct (could not find any space in it).

And the forum sitemaps works and show up perfectly.

So you can try to see if a small copy/paste problem is not the problem.
Try to overwrite sitemap.php and index_forum.php with fresh new files (you'll have to set up proper path for phpBB again in sitemap.php).

Just to make sure it's not an obvious mistake.

To check if it's ok, just load your sitemapIndex, it should show up the same way the forum sitemaps are, not like a txt list.

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21429
Joined: Fri Apr 28, 2006 9:03 pm

Postby Peter77 » Sat Jun 24, 2006 8:09 pm

Hmm, Now i'm getting this error in sitemap.php. I'll have to look into it more later and give more detail. I am on a slow connection. :?

Code: Select all
Warning: Cannot modify header information - headers already sent by (output started at /home/juar/public_html/modules/mx_ggsitemaps/includes/sitemap_newsitemap.php:23) in /home/juar/public_html/modules/mx_ggsitemaps/includes/index_forum.php on line 96
Peter77
phpBB SEO Team
phpBB SEO Team
 
Posts: 532
Joined: Wed May 10, 2006 9:46 am

Postby Silverado05 » Sat Jul 01, 2006 8:43 pm

The whitespace is at the very top. Their should be no spaces before <?php or after ?> If thier is just backspace it.
Silverado05
PR0
PR0
 
Posts: 51
Joined: Sat Jul 01, 2006 8:38 pm
Location: Texas

Postby Peter77 » Sat Jul 01, 2006 10:42 pm

Yeah there was whitespace after ?> in sitemap.php and some in includes and still was getting erros. my best bet was to upload and overwrite the MOD. I now have a tottaly differen't issue to resolve.

Thank you though. :)
Peter77
phpBB SEO Team
phpBB SEO Team
 
Posts: 532
Joined: Wed May 10, 2006 9:46 am

Postby Peter77 » Mon Jul 03, 2006 3:43 am

Success, it took a couple of days, but the sitemap was approved once agian with no errors. :)
Peter77
phpBB SEO Team
phpBB SEO Team
 
Posts: 532
Joined: Wed May 10, 2006 9:46 am

Postby dcz » Mon Jul 03, 2006 9:29 am

Good :D

You made sure you outputted the rewritten phpBB URLs I am sure ;)
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21429
Joined: Fri Apr 28, 2006 9:03 pm


Return to Google Forum

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: Exabot [Bot] and 3 guests