• Board index ‹ Special Interest Forum ‹ phpBB3 Mods
  • Change font size
  • FAQ • Search • Register • Login

It is currently Thu Mar 11, 2010 9:13 pm

XML sitemap generator for phpbb3?

Place to discuss phpbb3 modifications. Help, tips, ideas, suggestions...with no guarantees!!!!
Post a reply
3 posts • Page 1 of 1

XML sitemap generator for phpbb3?

Postby ..Ñøßߥ.. on Sun Jul 13, 2008 5:44 am

Has anyone come across a decent xml sitemap generator for phpbb3?

I have tried the one below, seemed simple enough, but its not complete and not intended for live forum use, which make its somewhat useless. The output isnt working quite right, or so it seems, anyone else found something suitable?

I was going to contact the original author, or at least check by his site, but at least for now, the site is down. I will have a tinker with the code later if i get some time, see whats going on.

Code: Select all
<?php
/**
*
* @author Tobi Schäfer http://www.seo-phpbb.org/
*
* @package phpBB3
* @version $Id: google-sitemap.php V0.1.1 2007-08-30 23:54:18 tas2580 $
* @copyright (c) 2005 phpBB Group; 2006 phpBB.de
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/

$domain_root = 'http://www.YOUR-DOMAIN.TLD/'; // Edit here



define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.'.$phpEx);

$user->session_begin();
$auth->acl($user->data);

if (is_numeric($_GET['fid'])) {
   $fid = $_GET['fid'];
}

echo header('Content-Type: text/xml; charset=utf-8');


if (isset($fid)) {
   echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
   echo '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">'."\n";
  $sql = 'SELECT  forum_topics, forum_id, forum_name FROM ' . FORUMS_TABLE . ' WHERE forum_id = "'. (int) $fid.'"';
  $result = $db->sql_query($sql);
  $forum_data = $db->sql_fetchrow($result);

  // Forums
  echo '<url>'. "\n";
  echo '   <loc>' . $domain_root .  'viewforum.' . $phpEx . '?f=' . $forum_data['forum_id'] . '</loc>'. "\n";
  echo '   <changefreq>hourly</changefreq>'. "\n";
  echo '</url>'. "\n";
   
   // Forums with more that 1 Page
   if ( $forum_data['forum_topics'] > $config['topics_per_page'] )
   {
      $pages = $forum_data['forum_topics'] / $config['topics_per_page'];
      for ($i = 1; $i < $pages; $i++)
      {
         $s = $s + $config['topics_per_page'];
        echo '<url>'. "\n";
        echo '   <loc>' . $domain_root .  'viewforum.' . $phpEx . '?f=' . $forum_data['forum_id'] . '&amp;start=' . $s . '</loc>'. "\n";
        echo '   <changefreq>hourly</changefreq>'. "\n";
        echo '</url>'. "\n";
      }
   }

  if ($forum_data['forum_id'] == $fid) {
   $sql = 'SELECT t.topic_title, t.topic_replies, t.topic_last_post_id, t.forum_id, t.topic_type, t.topic_id, p.post_time, p.post_id
   FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
   WHERE t.forum_id = '.$fid.'
   AND p.post_id = t.topic_last_post_id
   ORDER BY t.topic_type DESC, t.topic_last_post_id DESC';
   $result = $db->sql_query($sql);
    while ($data = $db->sql_fetchrow($result))
    {
       // Topics
      echo '<url>'. "\n";
      echo '   <loc>'. $domain_root . $forum_url . 'viewtopic.' . $phpEx . '?f=' . $forum_data['forum_id'] . '&amp;t=' . $data['topic_id'] . '</loc>'. "\n";
      echo '   <lastmod>'.date('Y-m-d', $data['post_time']),'</lastmod>'. "\n";
       echo '</url>'. "\n";

         // Topics with more that 1 Page
        if ( $data['topic_replies'] > $config['posts_per_page'] )
         {
            $s = 0;
            $pages = $data['topic_replies'] / $config['posts_per_page'];
            for ($i = 1; $i < $pages; $i++)
            {
               $s = $s + $config['posts_per_page'];
              echo '<url>'. "\n";
              echo '   <loc>'. $domain_root . $forum_url . 'viewtopic.' . $phpEx . '?f=' . $forum_data['forum_id'] . '&amp;t=' . $data['topic_id'] . '&amp;start=' . $s . '</loc>'. "\n";
              echo '   <lastmod>'.date('Y-m-d', $data['post_time']),'</lastmod>'. "\n";
              echo '</url>'. "\n";
            }
         }
    }
  }
  echo '</urlset>';
}

else

{
  echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
  echo '  <sitemapindex xmlns="http://www.google.com/schemas/sitemap/0.84">'."\n";
   $sql = 'SELECT forum_id FROM ' . FORUMS_TABLE;
  $result = $db->sql_query($sql);
  while($data = $db->sql_fetchrow($result))
  {
     if ($auth->acl_get('f_list', $data['forum_id']))
      {
        echo '    <sitemap>' . "\n";
      echo '       <loc>'. $domain_root .'google-sitemap.php?fid='.$data['forum_id'].'</loc>'. "\n";
      echo '       <changefreq>daily</changefreq>'. "\n";
         echo '    </sitemap>'. "\n";
    }
  }
  echo "\n".'  </sitemapindex>';
}

?>


Come to think of it, has anyone come across a good xml site map generator for regular static sites? I have seen a couple only 1 is of use for sites over 500 pages, however it seems to disagree with my server and leaves my site offline for a while, not good.
Link Building Services | Laser Teeth Whitening Products | Acne Home Treatment
User avatar
..Ñøßߥ..
Site God
 
Posts: 3403
Joined: Mon Dec 15, 2003 5:42 pm
Location: Darkness
Top

Re: XML sitemap generator for phpbb3?

Postby Vladd44 on Sun Jul 13, 2008 7:38 am

Have you checked out phpbb seo site's rss and sitemap generator?

Look at the footer of this forum to see the links. I still need to do a few more changes to it, but you get the idea.
Jewish Kid: Is anyone else having problems concentrating on this? I just can't seem to concentrate.
Cartman: Maybe we should send you to a concentration camp.
User avatar
Vladd44
Site Admin
 
Posts: 4573
Joined: Wed Dec 31, 1969 7:00 pm
Location: New Orleans Crypt 69
  • Website
Top

Re: XML sitemap generator for phpbb3?

Postby Vladd44 on Sun Jul 13, 2008 7:39 am

As far as the static, I will need to do something shortly, if you don't find anything, remind me and I will post what I end up using here and on static site.
Jewish Kid: Is anyone else having problems concentrating on this? I just can't seem to concentrate.
Cartman: Maybe we should send you to a concentration camp.
User avatar
Vladd44
Site Admin
 
Posts: 4573
Joined: Wed Dec 31, 1969 7:00 pm
Location: New Orleans Crypt 69
  • Website
Top


Post a reply
3 posts • Page 1 of 1


Return to phpBB3 Mods

Who is online

Users browsing this forum: No registered users and 0 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC - 6 hours [ DST ]
  • SitemapIndex SitemapIndex
  • RSS Feed RSS Feed
  • Channel list Channel list
© 2000, 2002, 2005, 2007 phpBB Group •
phpBB SEO
created by stylerbb.net & nero