|
<?='<?xml version="1.0" encoding="utf-8"?>'?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
<loc>[!--news.url--]</loc>
<changefreq>always</changefreq>
<priority>1.0</priority>
</url>
<?php
$sql=$empire->query('select classid,bclassid,classname,classpath,wburl,islast from '.$dbtbpre.'enewsclass order by myorder, classid asc ');
for($i=1;$cr=$empire->fetch($sql);$i++)
{
$r[$i]=$cr;//select出的数据储存到数组
}
for($i=1;$r[$i];$i++)
{
if($r[$i][bclassid]==0)//选出一级栏目
{
echo '<url>
<loc>'.$public_r[newsurl].''.($r[$i][classpath]==''?$r[$i][wburl]:''.$r[$i][classpath]).'/</loc>
<changefreq>daily</changefreq>
<priority>0.95</priority>
</url>';
if($r[$i][islast]==0&&$r[$i][wburl]=='')//选出非终极栏目
{
for($j=1;$r[$j];$j++)//循环数组一次
if($r[$j][bclassid]==$r[$i][classid] && $r[$j][islast]!=0)//选出二级栏目
{
echo '<url>
<loc>'.$public_r[newsurl].''.($r[$j][classpath]==''?$r[$j][wburl]:''.$r[$j][classpath]).'/</loc>
<changefreq>daily</changefreq>
<priority>0.9</priority>
</url>';
}else{
if($r[$j][bclassid]==$r[$i][classid])//选出三级栏目
{
echo '<url>
<loc>'.$public_r[newsurl].''.($r[$j][classpath]==''?$r[$j][wburl]:''.$r[$j][classpath]).'/</loc>
<changefreq>daily</changefreq>
<priority>0.9</priority>
</url>';
for($k=1;$r[$k];$k++)//循环数组一次
if($r[$k][bclassid]==$r[$j][classid])
echo '<url>
<loc>'.$public_r[newsurl].''.($r[$k][classpath]==''?$r[$k][wburl]:''.$r[$k][classpath]).'/</loc>
<changefreq>daily</changefreq>
<priority>0.9</priority>
</url>';
}
}
}
}
}
?>
[e:loop={0,30000,3,0,'','newstime DESC'}]
<url>
<loc><?=$bqsr['titleurl']?></loc>
<lastmod><?=date('Y-m-d',$bqr[newstime])?></lastmod>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
</url>
[/e:loop]
</urlset>
|
所有评论(0)