织梦 DEDE sitemap.php
<?php
require_once(dirname(__FILE__)."/../include/common.inc.php");
$page = isset($page) && is_numeric($page) ? intval($page) : 1;
$page = $page >= 1 ? $page : 1;
$pageSize = 5000; // ÿҳ3000ƪ
$sql = "SELECT id,title FROM `#@__archives` WHERE arcrank > -1 ORDER BY id ASC LIMIT ".($page-1)*$pageSize.",".$pageSize;
$dsql->SetQuery($sql);
$dsql->Execute("all");
header("Content-Type:text/xml;charset=UTF-8");
echo '<?xml version="1.0" encoding="UTF-8"?>'. "\r\n";
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"'."\n";
echo 'xmlns:mobile="http://www.baidu.com/schemas/sitemap-mobile/1/">'."\n";
while($row = $dsql->GetArray("all")){
echo "<url>\n";
echo "<loc>https://域名/目录/a/{$row['id']}.html</loc>\n";
echo "</url>\n";
echo '<mobile:mobile type="mobile"/>'."\n";
echo '<lastmod></lastmod>'."\n";
echo "<changefreq>daily</changefreq>\n";
echo "<priority>0.8</priority>\n";
}
echo "</urlset>\n";
$dsql->Close();
?>