Sitemap für phpbb3

Du suchst einen bestimmten Mod, weißt aber nicht genau wo bzw. ob er überhaupt existiert? Wenn dir dieser Artikel nicht weiterhilft, kannst du hier den von dir gewünschten/gesuchten Mod beschreiben ...
Falls ein Mod-Autor eine der Anfragen hier aufnimmt, um einen neuen Mod zu entwickeln, geht's in [3.0.x] Mods in Entwicklung weiter.
Forumsregeln
phpBB 3.0 hat das Ende seiner Lebenszeit überschritten
phpBB 3.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 3.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf die neuste phpBB-Version, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Antworten
TomW
Mitglied
Beiträge: 351
Registriert: 02.05.2002 22:55
Wohnort: Eichelsee
Kontaktdaten:

Sitemap für phpbb3

Beitrag von TomW »

Hallo,

Ich hatte für mein phpbb2 folgende php-Datei die mir eine Sitemap aus den ganzen Beiträgen vom Forum erstellt hat.

Code: Alles auswählen

<?php
/***************************************************************************
*
* Created:   Thursday, June 9, 2005 (Second to last day of Uni!)
* Author:   NeoThermic
* Modified:   fanrpg
*         Kortirion, Sunday, July 2, 2006
***************************************************************************/

/***************************************************************************
*
* 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.
*
***************************************************************************/
@set_time_limit(360);
ob_start();
define('IN_PHPBB', true);
$phpbb_root_path = 'phpbb/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//for testing, just mod this to be the base URL of your forums.
$secure = $board_config['cookie_secure'] ? 'https://' : 'http://';
$baseURL = $secure.$board_config['server_name'].$board_config['script_path'];

//we do this for hosts that have short tags enabled...
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <url>
      <loc><?php echo $baseURL; ?></loc>
      <lastmod><?php echo date("Y-m-d"); ?></lastmod>
      <changefreq>always</changefreq>
      <priority>0.8</priority>
   </url>
<?php

//we need to set up an array so that we can store the fourm_id's of any fourm that has a auth_view larger than 0
$hidtopic = array();
$sql = 'SELECT forum_id, forum_name, forum_desc, auth_read FROM '.FORUMS_TABLE.' ORDER BY forum_name';
if( !($result = $db->sql_query($sql)) )
{
   message_die(CRITICAL_ERROR, "Could not query forum auth information", "", __LINE__, basedir(__FILE__), $sql);
}

while ( $row = $db->sql_fetchrow($result) )
{
   $forum_name = $row['forum_name'];
   if ($row["auth_read"] < 1)
   {
   //note, we have the code de-tabbed like this to provide a cleaner output...
   echo '
   <url>
      <loc>'.$baseURL.append_sid('viewforum.php?f='.htmlspecialchars($row["forum_id"])).'</loc>
      <changefreq>daily</changefreq>
      <priority>0.8</priority>
   </url>';
   }
   else
   {
      //add fourm_id of the one here to an array
      $hidtopic[]= $row["forum_id"]; //ok, we now have populated the array with the fourm_ID of the hidden topics
   }
}

//ok, now we mod the below so that it reads fourm_id as well
$sql = "SELECT t.topic_title, t.topic_id, t.topic_replies, t.forum_id, p.post_time
   FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
   WHERE p.post_id = t.topic_last_post_id
   ORDER BY p.post_time DESC";

if( !($result = $db->sql_query($sql)) )
{
   message_die(CRITICAL_ERROR, "Could not query topic information", "", __LINE__, basedir(__FILE__), $sql);
}

if( $db->sql_numrows($result) >= 50000 )
{
   message_die(CRITICAL_MESSAGE, "Sitemap generated will be too large. Please modify file to make multiple sitemaps.");
}

$i = 0;
while($row =  $db->sql_fetchrow($result))
{
   if ($hidtopic[$i] != $row["forum_id"] && "17" != $row["forum_id"] && "23" != $row["forum_id"]) 
   {
      //if we get here, then the fourm_id of the post in question can be displaied...
      //same tabbing reason as above

      //Do tell thee, how many pages does one have?
      $perpage = $board_config['posts_per_page'];
      $numpages = intval($row['topic_replies']/$perpage);

      if ($numpages == 0)
      {
         $topic_title = $row['topic_title'];
         echo '
            <url>
               <loc>'.$baseURL.append_sid('viewtopic.php?t='.htmlspecialchars($row["topic_id"])).'</loc>';
            if ((time() - $row['post_time']) < 2600000)
            {
               echo '
                  <lastmod>'.date('Y-m-d',$row['post_time']).'</lastmod>
                  <priority>0.8</priority>
               </url>';
            }
            else
            {
               echo '
                  <changefreq>monthly</changefreq>
                  <priority>0.5</priority>
               </url>';
            }
      }
      else
      {
         for ($j = 0; $j < ($numpages+1); $j++)
         {
            $topic_title = $row['topic_title'];
            $start = $j * $perpage;
            echo'
               <url>
                  <loc>'.$baseURL.append_sid('viewtopic.php?t='.htmlspecialchars($row["topic_id"]).'&start='.$start).'</loc>';
            if ((time() - $row['post_time']) < 2600000)
            {
               echo '
                  <lastmod>'.date('Y-m-d',$row['post_time']).'</lastmod>
                  <priority>0.8</priority>
               </url>';
            }
            else
            {
               echo '
                  <changefreq>monthly</changefreq>
                  <priority>0.5</priority>
               </url>';
            }
         }
      }
   }
$i++;
}

$sql = "SELECT u.username, u.user_id FROM ".USERS_TABLE." u WHERE u.user_active = 1 AND u.user_active != '-1' ORDER BY u.user_id ASC";
$result = $db->sql_query($sql);
while( $row = $db->sql_fetchrow($result) )
{
   echo'
   <url>
      <loc>'.$baseURL.append_sid('profile.php?mode=viewprofile&u='.htmlspecialchars($row['user_id'])).'</loc>
      <changefreq>monthly</changefreq>
      <priority>0.3</priority>
   </url>';
}
?>
</urlset>
<?php
$xml = ob_get_contents();
ob_end_clean();
if( ($handle = fopen('/sitemap.xml', 'w')) )
{
   fwrite($handle, $xml);
   fclose($handle);
}
else
{
   echo $xml;
}   
?>
Kann mir die jemand fürs phpbb3 anpassen?
Oder gibt es diese schon irgendwo?

TomW
Computerprobleme??? -> http://www.weber-computerhilfe.de
Benutzeravatar
Miriam
Mitglied
Beiträge: 12310
Registriert: 13.10.2004 07:18
Kontaktdaten:

Re: Sitemap für phpbb3

Beitrag von Miriam »

Suche kaputt?
Wart', nimm meine: Sitemap FX
Gruss, Miriam.
Ich schmeiß' alles hin und...
... lasse es liegen
TomW
Mitglied
Beiträge: 351
Registriert: 02.05.2002 22:55
Wohnort: Eichelsee
Kontaktdaten:

Re: Sitemap für phpbb3

Beitrag von TomW »

Danke für den Link.

Ich hatte nur im Forum und nicht in der Mod-DB gesucht und dort habe ich nichts gefunden.

TomW
Computerprobleme??? -> http://www.weber-computerhilfe.de
TomW
Mitglied
Beiträge: 351
Registriert: 02.05.2002 22:55
Wohnort: Eichelsee
Kontaktdaten:

Re: Sitemap für phpbb3

Beitrag von TomW »

Ich habe noch eine Frage zu der Sitemap.
Welche Foren werde da indexiert? Auch die die nur für Admins sichtbar sind?

TomW
Computerprobleme??? -> http://www.weber-computerhilfe.de
Benutzeravatar
BNa
Valued Contributor
Beiträge: 3169
Registriert: 12.04.2010 23:51
Kontaktdaten:

Re: Sitemap für phpbb3

Beitrag von BNa »

die forenrechte werden natürlich eingehalten :wink:
Antworten

Zurück zu „[3.0.x] Mod Suche/Anfragen“