<pre id="bbfd9"><del id="bbfd9"><dfn id="bbfd9"></dfn></del></pre>

          <ruby id="bbfd9"></ruby><p id="bbfd9"><mark id="bbfd9"></mark></p>

          <p id="bbfd9"></p>

          <p id="bbfd9"><cite id="bbfd9"></cite></p>

            <th id="bbfd9"><form id="bbfd9"><dl id="bbfd9"></dl></form></th>

            <p id="bbfd9"><cite id="bbfd9"></cite></p><p id="bbfd9"></p>
            <p id="bbfd9"><cite id="bbfd9"><progress id="bbfd9"></progress></cite></p>
            php語言

            PHPBB生成sitemap地圖文件的方法

            時間:2025-04-08 04:53:55 php語言 我要投稿
            • 相關推薦

            PHPBB生成sitemap地圖文件的方法

              本文介紹下,在PHPBB論壇中生成sitemap地圖文件的實現代碼,感興趣的朋友參考學習下。就跟隨百分網小編一起去了解下吧,想了解更多相關信息請持續關注我們應屆畢業生考試網!

              將以下PHP文件放到網站的根目錄。

              加入此sitemap的前提:

              必須將PHPBB論壇的默認URL規格改成以下文件里生成的格式。

              具體方法,請參考:

              http://www.jbxue.com/article/13591.html

              注意:

              紅色部分的代碼,修改成自己網站對應的內容:

              復制代碼 代碼示例:

              <?php

              // By: Arlinger On 2012-6-4

              //

              // CUSTOM INSTALLATION VARIABLES:

              $subdomain='www.';

              $domain=' ';  //這里要改成你的網站名

              $folder='/forum/';                  //這里要改成你把博客所在的文件夾的名字

              $urls=50000;

              // Change Nothing Below Here:

              $domainpath='http://'.$subdomain.$domain.$folder;

              // Connect

              define('IN_PHPBB', true);

              $phpbb_root_path = './';

              $phpEx = substr(strrchr(__FILE__, '.'), 1);

              include($phpbb_root_path . 'config.' . $phpEx);

              include($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);

              $db = new $sql_db();

              $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false);

              // Gzip compression

              if (@extension_loaded('zlib') && !headers_sent())

              {

              ob_start('ob_gzhandler');

              }

              // Send Header

              header("Content-Type: text/xml;charset=iso-8859-1");

              // Send initial Data

              echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";

              echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n";

              // Send Index

              $current_time=time();

              echo '<url>

              <loc>'.$domainpath.'</loc>

              <lastmod>'.date("Y-m-d\TH:i:sP",$current_time).'</lastmod>

              </url>';

              $urls=$urls-1;

              // Send Forums

              $sql = 'SELECT forum_id, forum_last_post_time FROM '.$table_prefix.'forums WHERE enable_indexing=1 LIMIT '.$urls;

              $result = $db->sql_query($sql);

              while ($data=$db->sql_fetchrow($result)) {

              // Fix for parents forums showing 1969

              if ($data['forum_last_post_time'] == 0) {

              $data['forum_last_post_time']=$current_time;}

              echo '<url>

              <loc>'.$domainpath.'viewforum-'.$data['forum_id'].'.html'.'</loc>

              <lastmod>'.date("Y-m-d\TH:i:sP",$data['forum_last_post_time']).'</lastmod>

              </url>';

              $urls=$urls-1;

              }

              $db->sql_freeresult($result);

              // Send Topics

              $sql = 'SELECT * FROM '.$table_prefix.'topics as t, '.$table_prefix.'forums as f WHERE t.topic_approved=1 AND t.forum_id=f.forum_id AND f.enable_indexing=1 ORDER BY t.topic_id DESC LIMIT '.$urls;

              $result = $db->sql_query($sql);

              while ($data=$db->sql_fetchrow($result)) {

              echo '<url>

              <loc>'.$domainpath.'viewtopic-'.$data['topic_id'].'.html'.'</loc>

              <lastmod>'.date("Y-m-d\TH:i:sP",$data['topic_last_post_time']).'</lastmod>

              </url>';

              }

              $db->sql_freeresult($result);

              // Send Closing Tags

              echo '  </urlset>';

              ?>

            【PHPBB生成sitemap地圖文件的方法】相關文章:

            PHP中BB生成sitemap地圖文件的方法11-06

            PHP生成SiteMap文件代碼的方法10-30

            PHP生成SiteMap文件的代碼09-27

            php自動生成sitemap地圖代碼10-21

            php自動生成sitemap地圖的代碼10-07

            php自動生成sitemap地圖的代碼07-31

            php sitemap文件生成器代碼07-11

            php生成sitemap.xml的實例代碼06-02

            PHP生成PDF文件withFPDF10-28

                    <pre id="bbfd9"><del id="bbfd9"><dfn id="bbfd9"></dfn></del></pre>

                    <ruby id="bbfd9"></ruby><p id="bbfd9"><mark id="bbfd9"></mark></p>

                    <p id="bbfd9"></p>

                    <p id="bbfd9"><cite id="bbfd9"></cite></p>

                      <th id="bbfd9"><form id="bbfd9"><dl id="bbfd9"></dl></form></th>

                      <p id="bbfd9"><cite id="bbfd9"></cite></p><p id="bbfd9"></p>
                      <p id="bbfd9"><cite id="bbfd9"><progress id="bbfd9"></progress></cite></p>
                      飘沙影院