Sitemap erstellen ?

Fragen zu allen Themen rund ums Programmieren außerhalb von phpBB können hier gestellt werden - auch zu anderen Programmiersprachen oder Software wie Webservern und Editoren.
PFstyle
Mitglied
Beiträge: 31
Registriert: 06.11.2005 09:47

Sitemap erstellen ?

Beitrag von PFstyle »

Hi, ich würde gerne wissen wie ich eine Sitemap für mein phpBB erstellen kann ??! Dank für eure Hilfe !
Benutzeravatar
Bonaparte
Mitglied
Beiträge: 308
Registriert: 07.12.2004 23:24
Wohnort: Hamburg
Kontaktdaten:

Beitrag von Bonaparte »

PFstyle
Mitglied
Beiträge: 31
Registriert: 06.11.2005 09:47

Beitrag von PFstyle »

ich braüchte eine die ich dann Google liefern kann also ne .XML datei !

Gibts da was ? Muss auch kein Mod sein !
Benutzeravatar
S2B
Ehemaliges Teammitglied
Beiträge: 3258
Registriert: 10.08.2004 22:48
Wohnort: Aachen
Kontaktdaten:

Beitrag von S2B »

Gruß, S2B
Keinen Support per ICQ/PM!
Hier kann man meine PHP-Skripte und meine MODs für phpBB runterladen.
PFstyle
Mitglied
Beiträge: 31
Registriert: 06.11.2005 09:47

Beitrag von PFstyle »

Habs mir mal geladen doch was muss ich jetzt tun ?

Code: Alles auswählen

<?php
//  ==========================================================================
//  phpBB Google Sitemap Generator v1.0.0
//  http://www.gotaxe.com/phpbb-sitemap.php
//  ==========================================================================
//  Script created by John Brookes
//  Copyright John Brookes ©2005
//  http://www.gotaxe.com
//  ==========================================================================
//  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.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
//  ==========================================================================

// Some configuration options!

define('FORUM_DOMAIN_ROOT', 'http://www.yourdomain.com/'); // Full URL with trailing slash!

define('FORUM_URL_PREFIX', 'viewforum.php?f='); // What comes up before the forum ID?
define('FORUM_URL_SUFFIX', ''); // What comes up after the forum ID?
define('THREAD_URL_PREFIX', 'viewtopic.php?t='); // What comes up before the thread ID?
define('THREAD_URL_SUFFIX', ''); // What comes up after the thread ID?

// --------------------------------------------------
// You don't need to edit anything below this line!!!
// --------------------------------------------------

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

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

// Sitemap File    <sitemapindex xmlns="http://www.google.com/schemas/sitemap/0.84">
// URL Index File  <urlset xmlns="http://www.google.com/schemas/sitemap/0.84">';
if (isset($fid)) {
  echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
  if ($fid == '65535') {
    // Let's first send out the header & homepage
    echo '  <urlset xmlns="http://www.google.com/schemas/sitemap/0.84">'."\n";
    echo '    <url>
      <loc>'.FORUM_DOMAIN_ROOT.'</loc>
      <changefreq>daily</changefreq>
    </url>';
    // Let's send out a URL list of forums
    $sql = 'SELECT forum_id FROM phpbb_forums WHERE auth_view = "0" and auth_read = "0"';
    $result = mysql_query($sql);
    while ($data = mysql_fetch_assoc($result)) {
      echo '    <url>
      <loc>'.FORUM_DOMAIN_ROOT.FORUM_URL_PREFIX.$data['forum_id'].FORUM_URL_SUFFIX.'</loc>
      <changefreq>daily</changefreq>
    </url>';
    }
    echo '  </urlset>';
  } else {
    // Let's check it's not a restricted forum
    $sql = 'SELECT forum_id FROM phpbb_forums WHERE auth_view = "0" and auth_read = "0" and forum_id = "'.$fid.'"';
    $result = mysql_query($sql);
    $data = mysql_fetch_assoc($result);
    if ($data['forum_id'] == $fid) {
      echo '  <urlset xmlns="http://www.google.com/schemas/sitemap/0.84">'."\n";
      $sql = 'SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time FROM phpbb_topics t, phpbb_users u, phpbb_posts p, phpbb_posts p2, phpbb_users u2 WHERE t.forum_id = '.$fid.' AND t.topic_poster = u.user_id AND p.post_id = t.topic_first_post_id AND p2.post_id = t.topic_last_post_id AND u2.user_id = p2.poster_id ORDER BY t.topic_type DESC, t.topic_last_post_id DESC';
      $result = mysql_query($sql);
      while ($data = mysql_fetch_assoc($result)) {
        echo '    <url>
      <loc>'.FORUM_DOMAIN_ROOT.THREAD_URL_PREFIX.$data['topic_id'].THREAD_URL_SUFFIX.'</loc>
      <lastmod>'.date('Y-m-d', $data['post_time']),'</lastmod>
    </url>';
        
      }
     echo '  </urlset>';

    }
  }
} else {
  echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
  echo '  <sitemapindex xmlns="http://www.google.com/schemas/sitemap/0.84">'."\n";
    // Let's create a link to the main forum index sitemap
  echo '    <sitemap>
      <loc>'.FORUM_DOMAIN_ROOT.'forum-65535.xml</loc>
      <changefreq>monthly</changefreq>
   </sitemap>';
    // Let's do a loop here and list all the forums!
    $sql = 'SELECT forum_id FROM phpbb_forums WHERE auth_view = "0" and auth_read = "0"';
    $result = mysql_query($sql);
    while ($data = mysql_fetch_assoc($result)) {
      echo '    <sitemap>
      <loc>'.FORUM_DOMAIN_ROOT.'forum-'.$data['forum_id'].'.xml</loc>
      <changefreq>daily</changefreq>
   </sitemap>';
    }
  echo "\n".'  </sitemapindex>';
}

?>

Was bedeutet das ?

Code: Alles auswählen

define('FORUM_URL_PREFIX', 'viewforum.php?f='); // What comes up before the forum ID?
define('FORUM_URL_SUFFIX', ''); // What comes up after the forum ID?
define('THREAD_URL_PREFIX', 'viewtopic.php?t='); // What comes up before the thread ID?
define('THREAD_URL_SUFFIX', ''); // What comes up after the thread ID?
lg, PF
Benutzeravatar
V1tzl1
Mitglied
Beiträge: 157
Registriert: 10.10.2005 15:31

Beitrag von V1tzl1 »

Ganz einfach, jedes Thema wird ja so angezeigt viewtopic.php?t=15
Also ist der Prefix viewtopic.php?t=
hasst du zum Bleistift den Dateinamen von viewtopic geändert müsstest du es dort in der Datei auch ändern. Übergibst du noch etwas anderes zb: viewtopic.php?t=15&geheimniss=1+1=2 oder so, dann müsstest du als Suffix &geheimniss=1+1=2 angeben
PFstyle
Mitglied
Beiträge: 31
Registriert: 06.11.2005 09:47

Beitrag von PFstyle »

versteh ich nicht. Kannst du es vielleich abändern ?
PFstyle
Mitglied
Beiträge: 31
Registriert: 06.11.2005 09:47

Beitrag von PFstyle »

Hi, also dass mit dem Prefixis verstanden, aber das mit dem suffix habe ich nicht kapiert. Ich glaube in meinem Forum keinen Suffix zu haben.

Kann sich das mal einer Anschauen ?

http://www.ffdesign.de/privat/phillipp/phpBB/
kommt mich besuchen!

http://www.e-phillipp.de/phpBB
Benutzeravatar
Miroerr
Mitglied
Beiträge: 611
Registriert: 21.11.2005 21:47
Kontaktdaten:

Beitrag von Miroerr »

Hm...Google Sitemaps:

sitemap.php Sitemap Index OK
sitemap.xml Sitemap Index Unsupported file format
Weshalb das :) ?

@ Beitrag über mir:
define('FORUM_URL_PREFIX', 'viewforum.php?f='); // What comes up before the forum ID?
define('FORUM_URL_SUFFIX', ''); // What comes up after the forum ID?

Why define something like this? All forums are the same aren't they? Well, no.

You may have implemented some form of mod_rewrite work to offer .html URLs to
facilitate spidering & SEO in the past. It makes sense, then, that your
sitemap would also be best using these URLs.

The phpBB default is simply viewforum.php?f=#, where # is the ID of the forum.
However, your site might load this page up as forum-#.html (again, where # is
the ID of the forum). In this example, you would modify the two lines above as
follows...

define('FORUM_URL_PREFIX', 'forum-'); // What comes up before the forum ID?
define('FORUM_URL_SUFFIX', '.html'); // What comes up after the forum ID?
PFstyle
Mitglied
Beiträge: 31
Registriert: 06.11.2005 09:47

Beitrag von PFstyle »

Miroerr hat geschrieben:Hm...Google Sitemaps:

sitemap.php Sitemap Index OK
sitemap.xml Sitemap Index Unsupported file format
Weshalb das :) ?
Kapier ich nicht.


Bei mir gibts nichts hinter der forum ID :o
kommt mich besuchen!

http://www.e-phillipp.de/phpBB
Antworten

Zurück zu „Coding & Technik“