Yuu are missing ? befor xml in:
$output = '<xml version="1.0" encoding="UTF-8"?>'."\n";
I also edited a code a little bit, so that the first page in the thread doesn't get "&p=1", this is what I ended with:
<?php
/***************************************************************************
* googlesitemapgenerator.php
* -------------------
* Copyright/Support http://www.pentapenguin.com
* Last Modified: 06/05/05
* Modified by Smartys for use with PunBB
*
***************************************************************************/
/***************************************************************************
*
* 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.
*
***************************************************************************/
define('PUN_QUIET_VISIT', 1);
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
// false = write to file, true = dynamic
$dynamic = true;
// This only matters if you're writing to the file
$filename = 'sitemap.xml';
// Get the topics
$result = $db->query('SELECT t.id as topic_id, last_post, sticky, num_replies FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL ORDER BY last_post DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
// Get the forums
$result2 = $db->query('SELECT f.id as forum_id, last_post, num_topics FROM '.$db->prefix.'forums AS f LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE fp.read_forum IS NULL OR fp.read_forum=1 ORDER BY f.id DESC') or error('Unable to fetch forum list', __FILE__, __LINE__, $db->error());
$output = '<?xml version="1.0" encoding="UTF-8"?>'."\n";
$output .= '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">'."\n";
// The board itself
$output .= "<url>\n";
$output .= "\t<loc>".$pun_config['o_base_url']."/</loc>\n";
$output .= "\t<lastmod>".gmdate('Y-m-d\TH:i:s+00:00', time())."</lastmod>\n";
$output .= "\t<priority>1.0</priority>\n";
$output .= "</url>\n\n";
// Output the data for the forums
while ($cur_forum = $db->fetch_assoc($result2))
{
$lastmodified = gmdate('Y-m-d\TH:i:s+00:00', $cur_forum['last_post']);
$viewforum = 'viewforum.php?id='.$cur_forum['forum_id'];
$priority = '1.0';
if ($cur_forum['num_topics'] >= $pun_config['o_disp_topics_default'])
{
$num_pages = ceil($cur_forum['num_topics'] / $pun_config['o_disp_topics_default']);
//Don't add &p=1 to the firs page
$output .= "<url>\n";
$output .= "\t<loc>".$pun_config['o_base_url']."/".$viewforum."</loc>\n";
$output .= "\t<lastmod>$lastmodified</lastmod>\n";
$output .= "\t<priority>$priority</priority>\n";
$output .= "</url>\n\n";
//Add page number for subsequent pages
for ($i = 2; $i <= $num_pages; $i++)
{
$output .= "<url>\n";
$output .= "\t<loc>".$pun_config['o_base_url']."/".$viewforum."&p=".$i."</loc>\n";
$output .= "\t<lastmod>$lastmodified</lastmod>\n";
$output .= "\t<priority>$priority</priority>\n";
$output .= "</url>\n\n";
}
}
else
{
$output .= "<url>\n";
$output .= "\t<loc>".$pun_config['o_base_url']."/".$viewforum."</loc>\n";
$output .= "\t<lastmod>$lastmodified</lastmod>\n";
$output .= "\t<priority>$priority</priority>\n";
$output .= "</url>\n\n";
}
}
// Output the data for the topics
while ($cur_topic = $db->fetch_assoc($result))
{
$lastmodified = gmdate('Y-m-d\TH:i:s+00:00', $cur_topic['last_post']);
$viewtopic = 'viewtopic.php?id='.$cur_topic['topic_id'];
$priority = ($cur_topic['sticky'] == '1') ? '1.0' : '0.5';
if ($cur_topic['num_replies'] >= $pun_config['o_disp_posts_default'])
{
// We add one because the first post is not counted as a reply but needs to be
// taken into account for display
$num_pages = ceil(($cur_topic['num_replies'] + 1) / $pun_config['o_disp_posts_default']);
$output .= "<url>\n";
$output .= "\t<loc>".$pun_config['o_base_url']."/".$viewtopic."</loc>\n";
$output .= "\t<lastmod>$lastmodified</lastmod>\n";
$output .= "\t<priority>$priority</priority>\n";
$output .= "</url>\n\n";
for ($i = 2; $i <= $num_pages; $i++)
{
$output .= "<url>\n";
$output .= "\t<loc>".$pun_config['o_base_url']."/".$viewtopic."&p=".$i."</loc>\n";
$output .= "\t<lastmod>$lastmodified</lastmod>\n";
$output .= "\t<priority>$priority</priority>\n";
$output .= "</url>\n\n";
}
}
else
{
$output .= "<url>\n";
$output .= "\t<loc>".$pun_config['o_base_url']."/".$viewtopic."</loc>\n";
$output .= "\t<lastmod>$lastmodified</lastmod>\n";
$output .= "\t<priority>$priority</priority>\n";
$output .= "</url>\n\n";
}
}
$output .= "</urlset>\n";
// If we chose dynamic, we output the sitemap
// Otherwise, we write it to the file
if ($dynamic)
{
header('Content-type: application/xml');
echo $output;
}
else
{
$file = fopen($filename, "w");
fwrite($file, $output);
fclose($file);
echo "Done";
}
?>
http://www.info-mob.com/forum/ - Croatian forum only, don't bother if you don't speak Croatian :)