9.4 应用举例 网站地图xml
说明:转载请说明出处 作者:杨青青
<?='<?xml version="1.0" encoding="UTF-8"?>'?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url><loc>[!--news.url--]</loc><priority>1.000</priority></url> [e:loop={"select * from [!db.pre!]enewsclass order by myorder",0,24,0}]<?if($bqr['classurl']==""){$sccurl=$public_r['newsurl'].$bqr['classpath']."/";}else{$sccurl=$bqr['classurl']."/";}?><url><loc><?=$sccurl?></loc><priority>0.6000</priority></url>[/e:loop] [e:loop={"select * from [!db.pre!]ecms_news order by id desc",0,24,0}]<url><loc><?=$bqsr[titleurl]?></loc><lastmod><?=format_datetime($bqr[newstime],'Y-m-d')?></lastmod><priority>0.7000</priority></url>[/e:loop]</urlset>
如果有多个模型,需要把模型都写进去,例如
<?='<?xml version="1.0" encoding="UTF-8"?>'?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url><loc>[!--news.url--]</loc><priority>1.000</priority></url> [e:loop={"select * from [!db.pre!]enewsclass order by myorder",0,24,0}]<?if($bqr['classurl']==""){$sccurl=$public_r['newsurl'].$bqr['classpath']."/";}else{$sccurl=$bqr['classurl']."/";}?><url><loc><?=$sccurl?></loc><priority>0.6000</priority></url>[/e:loop] [e:loop={"select * from [!db.pre!]ecms_news order by id desc",0,24,0}]<url><loc><?=$bqsr[titleurl]?></loc><lastmod><?=format_datetime($bqr[newstime],'Y-m-d')?></lastmod><priority>0.7000</priority></url>[/e:loop][e:loop={"select * from [!db.pre!]ecms_photo order by id desc",0,24,0}]<url><loc><?=$bqsr[titleurl]?></loc><lastmod><?=format_datetime($bqr[newstime],'Y-m-d')?></lastmod><priority>0.7000</priority></url>[/e:loop][e:loop={"select * from [!db.pre!]ecms_movie order by id desc",0,24,0}]<url><loc><?=$bqsr[titleurl]?></loc><lastmod><?=format_datetime($bqr[newstime],'Y-m-d')?></lastmod><priority>0.7000</priority></url>[/e:loop] </urlset>
- 上一篇
- 下一篇