欢迎访问 舍力博客(www.shuyong.net)
<?xml version="1.0" encoding="{dede:global.cfg_soft_lang /}"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>{dede:global.cfg_basehost/}</loc> <changefreq>always</changefreq> <priority>1.0</priority> </url> {dede:arclist row='10000' orderby='pubdate'} <url> <loc>[field:arcurl/]</loc> <lastmod>[field:pubdate function="GetDateMK(@me)"/]</lastmod> </url> {/dede:arclist} {dede:channelartlist row='50'} <url> <loc>{dede:field name='typeurl'/}</loc> <lastmod>{dede:php}echo date('Y-m-d');{/dede:php}</lastmod> </url> {dede:channel type='son' row='8'} <url> <loc>[field:typelink/]</loc> <lastmod>[field:id runphp="yes"]@me=date('Y-m-d');[/field:id]</lastmod> </url> {/dede:channel} {/dede:channelartlist} </urlset>
<?xml version='1.0' encoding='UTF-8'?> <urlset xmlns='http://www.google.com/schemas/sitemap/0.84'> {dede:arclist typeid='0' } <url><loc>[field:arcurl/]</loc><lastmod>[field:pubdate function="MyDate('Y-m-d',@me)"/]</lastmod><changefreq>daily</changefreq><priority>1.0</priority></url> {/dede:arclist} {dede:channelartlist row='50'} <url><loc>{dede:field name='typeurl'/}</loc><lastmod>{dede:php}echo date('Y-m-d');{/dede:php}</lastmod><changefreq>daily</changefreq><priority>1.0</priority></url> {dede:channel type='son' row='10000'} <url><loc>[field:typelink/]</loc><lastmod>[field:id runphp="yes"]@me=date('Y-m-d');[/field:id]</lastmod><changefreq>daily</changefreq><priority>1.0</priority></url> {/dede:channel} {/dede:channelartlist} </urlset>
<?php
/**
* 生成网站地图
*
* @version $Id: makehtml_map.php 1 11:17 2010年7月19日Z tianya $
* @package DedeCMS.Administrator
* @copyright Copyright (c) 2007 - 2010, DesDev, Inc.
* @license http://help.dedecms.com/usersguide/license.html
* @link http://www.dedecms.com
*/
require_once(dirname(__FILE__)."/config.php");
require_once(DEDEINC."/sitemap.class.php");
require_once(DEDEINC."/dedetag.class.php");
require_once DEDEINC."/arc.partview.class.php";
if(empty($dopost))
{
ShowMsg("参数错误!","-1");
exit();
}
$isremote = empty($isremote)? 0 : $isremote;
$serviterm=empty($serviterm)? "" : $serviterm;
$sm = new SiteMap();
$maplist = $sm->GetSiteMap($dopost);
if($dopost=="site")
{
$murl = $cfg_cmspath."/sitemap.xml";
$tmpfile = $cfg_basedir.$cfg_templets_dir."/plus/sitemap.htm";
}
else
{
$murl = $cfg_cmspath."/rssmap.xml";
$tmpfile = $cfg_basedir.$cfg_templets_dir."/plus/rssmap.htm";
}
//$dtp = new DedeTagParse();
//$dtp->LoadTemplet($tmpfile);
//$dtp->SaveTo($cfg_basedir.$murl);
$pv = new PartView();
$pv->SetTemplet($tmpfile); //在这里修改你的谷歌地图模板路径,相对于模板目录
$pv->SaveToHtml($cfg_basedir.$murl); //生成文件名,保存在根目录
if($cfg_remote_site=='Y' && $isremote == 1)
{
if($serviterm!="")
{
list($servurl, $servuser, $servpwd) = explode(',', $serviterm);
$config=array( 'hostname' => $servurl, 'username' => $servuser,
'password' => $servpwd,'debug' => 'TRUE');
} else {
$config=array();
}
if( $ftp->connect($config) )
{
//分析远程文件路径
$remotefile = $murl;
$localfile = '..'.$remotefile;
$remotedir = preg_replace('#[^\/]*\.html#', '', $remotefile);
$ftp->rmkdir($remotedir);
if($ftp->upload($localfile, $remotefile, 'acii')) echo "远程发布成功!"."<br />";
}
}
//$pv->Clear();
echo "<a href='$murl' target='_blank'>成功更新文件: $murl 浏览...</a>";
exit();
留言/评论:◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。