建一目录 php
在php下的 建一文件 sitemap.php 记住 还要复制dedecms的dede目录下的
config.php到本目录(php目录)下
删除 config.php里面的判断管理员登录的语句 大约34行到39行 (
config.php文件就不复制到这个地方了)
sitemap.php 文件如下<?php
/**
* 生成网站地图
*
$_GET['dopost'] = 'site'; 是生成站点地地图
*
$_GET['dopost'] = 'rss'; 是生成rss地图
*
* @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");
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.html";
$tmpfile = $cfg_basedir.$cfg_templets_dir."/plus/sitemap.htm";
}
else
{
$murl = $cfg_cmspath."/rssmap.html";
$tmpfile = $cfg_basedir.$cfg_templets_dir."/plus/rssmap.htm";
}
$dtp = new DedeTagParse();
$dtp->LoadTemplet($tmpfile);
$dtp->SaveTo($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 />";
}
}
$dtp->Clear();
$fp = fopen($cfg_basedir.$murl,'r');
$output = fread($fp,filesize($cfg_basedir.$murl));
fclose($fp);
echo $output;
exit();