dedecms织梦系统生成wap手机版静态页完整版
在442行增加函数代码
function MakeWapHtml($isremote=0)
{
global $cfg_df_style,$cfg_arcdir;
$tempfile = $this->GetTempletFile();
$tempfile = str_replace(‘/’ . $cfg_df_style . ‘/’,DEDEWAPTEMPLATESPATH,$tempfile);
if(!file_exists($tempfile) || !is_file($tempfile))
{
}else{
global $cfg_remote_site,$fileFirst;
if($this->IsError)
{
return ”;
}
$this->Fields[“displaytype”] = “st”;
//预编译$th
$this->dtp->LoadTemplate($tempfile);
$this->TempSource = $this->dtp->SourceString;
$this->ParAddTable();
$this->ParseTempletsFirst();
$this->Fields[‘senddate’] = empty($this->Fields[‘senddate’])? ” : $this->Fields[‘senddate’];
$this->Fields[‘title’] = empty($this->Fields[‘title’])? ” : $this->Fields[‘title’];
$this->Fields[‘arcrank’] = empty($this->Fields[‘arcrank’])? 0 : $this->Fields[‘arcrank’];
$this->Fields[‘ismake’] = empty($this->Fields[‘ismake’])? 0 : $this->Fields[‘ismake’];
$this->Fields[‘money’] = empty($this->Fields[‘money’])? 0 : $this->Fields[‘money’];
$this->Fields[‘filename’] = empty($this->Fields[‘filename’])? ” : $this->Fields[‘filename’];
//分析要创建的文件名称
$filename = GetFileNewName(
$this->ArcID,$this->Fields[‘typeid’],$this->Fields[‘senddate’],
$this->Fields[‘title’],$this->Fields[‘ismake’],$this->Fields[‘arcrank’],
$this->TypeLink->TypeInfos[‘namerule’],$this->TypeLink->TypeInfos[‘typedir’],$this->Fields[‘money’],$this->Fields[‘filename’]
);
$filename=str_replace($cfg_arcdir .’/’,DEDEWAPPATH .’/’,$filename);
$filenames = explode(“.”, $filename);
$this->ShortName = $filenames[count($filenames)-1];
if($this->ShortName==”) $this->ShortName = ‘html’;
$fileFirst = preg_replace(“/.”.$this->ShortName.”$/i”, “”, $filename);
$this->Fields[‘namehand’] = basename($fileFirst);
$filenames = explode(“/”, $filename);
$this->NameFirst = preg_replace(“/.”.$this->ShortName.”$/i”, “”, $filenames[count($filenames)-1]);
if($this->NameFirst==”)
{
$this->NameFirst = $this->arcID;
}
//获得当前文档的全名
$filenameFull = GetFileUrl(
$this->ArcID,$this->Fields[‘typeid’],$this->Fields[“senddate”],
$this->Fields[“title”],$this->Fields[“ismake”],
$this->Fields[“arcrank”],$this->TypeLink->TypeInfos[‘namerule’],$this->TypeLink->TypeInfos[‘typedir’],$this->Fields[“money”],$this->Fields[‘filename’],
$this->TypeLink->TypeInfos[‘moresite’],$this->TypeLink->TypeInfos[‘siteurl’],$this->TypeLink->TypeInfos[‘sitepath’]
);
$this->Fields[‘arcurl’] = $this->Fields[‘fullname’] = $filenameFull;
//对于已设置不生成HTML的文章直接返回网址
if($this->Fields[‘ismake’]==-1 || $this->Fields[‘arcrank’]!=0 || $this->Fields[‘money’]>0
|| ($this->Fields[‘typeid’]==0 && $this->Fields[‘channel’] != -1) )
{
return $this->GetTrueUrl($filename);
}
//循环生成HTML文件
else
{
for($i=1;$i<=$this->TotalPage;$i++)
{
if($this->TotalPage > 1) {
$this->Fields[‘tmptitle’] = (empty($this->Fields[‘tmptitle’]) ? $this->Fields[‘title’] : $this->Fields[‘tmptitle’]);
if($i>1) $this->Fields[‘title’] = $this->Fields[‘tmptitle’].”($i)”;
}
if($i>1)
{
$TRUEfilename = $this->GetTruePath().$fileFirst.”_”.$i.”.”.$this->ShortName;
}
else
{
$TRUEfilename = $this->GetTruePath().$filename;
}
$this->ParseDMFields($i,1);
if(!is_dir(dirname($TRUEfilename))) {
mkdir(dirname($TRUEfilename), 0777, true);
}
$this->dtp->SaveTo($TRUEfilename);
//如果启用远程发布则需要进行判断
if($cfg_remote_site==’Y’ && $isremote == 1)
{
//分析远程文件路径
$remotefile = str_replace(DEDEROOT, ”, $TRUEfilename);
$localfile = ‘..’.$remotefile;
//创建远程文件夹
$remotedir = preg_replace(“#[^/]*.html#”, ”, $remotefile);
$this->ftp->rmkdir($remotedir);
$this->ftp->upload($localfile, $remotefile, ‘ascii’);
}
}
}
$this->TempSource==”;
}
☉本站提供的源码、模板、软件工具等其他资源,都不包含技术服务,请大家谅解!
pbootcms模板网 » dedecms织梦系统生成wap手机版静态页完整版