dedecms删除文章的同时自动删除生成的html文件_DedeCms教程
教程Tag:暂无Tag,欢迎添加,赚取U币!
功能:删除文章的同时自动删除生成的html文件
前两天改的忘记改删除文章分页了,这回修正一下:)
可以删除文章分页HTML了
第一步:
archives表建立一字段:arcurl
第二步:打开inc_archives_view.php
找到
CODE: //循环生成HTML文件
//------------------------------------------------- [Copy to clipboard]
改为
CODE: //循环生成HTML文件
//-------------------------------------------------
for($i=1;$i<=$this->TotalPage;$i )
{
if($i>1){ $truefilename = $cfg_basedir.$fileFirst."_".$i.".".$this->ShortName;
$filenamefy = $fileFirst."_".$i.".".$this->ShortName;
$filenameall = $filenameall.':'.$filenamefy;
}
else{ $truefilename = $cfg_basedir.$filename;
$filenameall = $filename.$filenameall;
}
$this->ParseDMFields($i,1);
$this->dtp->SaveTo($truefilename);
}
$this->dsql->SetQuery("Update dede_archives set ismake=1,arcurl='$filenameall' where ID='".$this->ArcID."'");
$this->dsql->ExecuteNoneQuery();
$this->Close();
return $filename;
} [Copy to clipboard]
第三步:打开archives_do.php
找到
CODE: //读取文档信息
$arctitle = "";
$arcurl = "";
$arcQuery = "
Select dede_archives.title,dede_channeltype.addtable From dede_archives
left join dede_channeltype on dede_channeltype.ID=dede_archives.channel where dede_archives.ID='$aid'
";
$arcRow = $dsql->GetOne($arcQuery);
。。。
。。到。。
}//foreach [Copy to clipboard]
改为
CODE: //读取文档信息
$arcQuery = "
Select dede_archives.title,dede_archives.arcurl,dede_channeltype.addtable From dede_archives
left join dede_channeltype on dede_channeltype.ID=dede_archives.channel where dede_archives.ID='$aid'
";
$arcRow = $dsql->GetOne($arcQuery);
$arcurl = $arcRow['arcurl'];
$arcurls = explode(":",$arcurl);
$num_arcurls = count($arcurls)-1;
if(!is_array($arcRow)){ continue; }
$dsql->SetQuery("Delete From dede_archives where ID='$aid'");
$dsql->ExecuteNoneQuery();
if($arcRow['addtable']!=""){
$dsql->SetQuery("Delete From ".$arcRow['addtable']." where aid='$aid'");
$dsql->ExecuteNoneQuery();
}
$dsql->SetQuery("Delete From dede_feedback where aid='$aid'");
$dsql->ExecuteNoneQuery();
if(!ereg("?",$arcurl)){
if ($num_arcurls <2){
$htmlfile = $cfg_basedir.$arcurl;
if(file_exists($htmlfile) && !is_dir($htmlfile)) unlink($htmlfile);
前两天改的忘记改删除文章分页了,这回修正一下:)
可以删除文章分页HTML了
第一步:
archives表建立一字段:arcurl
第二步:打开inc_archives_view.php
找到
CODE: //循环生成HTML文件
//------------------------------------------------- [Copy to clipboard]
改为
CODE: //循环生成HTML文件
//-------------------------------------------------
for($i=1;$i<=$this->TotalPage;$i )
{
if($i>1){ $truefilename = $cfg_basedir.$fileFirst."_".$i.".".$this->ShortName;
$filenamefy = $fileFirst."_".$i.".".$this->ShortName;
$filenameall = $filenameall.':'.$filenamefy;
}
else{ $truefilename = $cfg_basedir.$filename;
$filenameall = $filename.$filenameall;
}
$this->ParseDMFields($i,1);
$this->dtp->SaveTo($truefilename);
}
$this->dsql->SetQuery("Update dede_archives set ismake=1,arcurl='$filenameall' where ID='".$this->ArcID."'");
$this->dsql->ExecuteNoneQuery();
$this->Close();
return $filename;
} [Copy to clipboard]
第三步:打开archives_do.php
找到
CODE: //读取文档信息
$arctitle = "";
$arcurl = "";
$arcQuery = "
Select dede_archives.title,dede_channeltype.addtable From dede_archives
left join dede_channeltype on dede_channeltype.ID=dede_archives.channel where dede_archives.ID='$aid'
";
$arcRow = $dsql->GetOne($arcQuery);
。。。
。。到。。
}//foreach [Copy to clipboard]
改为
CODE: //读取文档信息
$arcQuery = "
Select dede_archives.title,dede_archives.arcurl,dede_channeltype.addtable From dede_archives
left join dede_channeltype on dede_channeltype.ID=dede_archives.channel where dede_archives.ID='$aid'
";
$arcRow = $dsql->GetOne($arcQuery);
$arcurl = $arcRow['arcurl'];
$arcurls = explode(":",$arcurl);
$num_arcurls = count($arcurls)-1;
if(!is_array($arcRow)){ continue; }
$dsql->SetQuery("Delete From dede_archives where ID='$aid'");
$dsql->ExecuteNoneQuery();
if($arcRow['addtable']!=""){
$dsql->SetQuery("Delete From ".$arcRow['addtable']." where aid='$aid'");
$dsql->ExecuteNoneQuery();
}
$dsql->SetQuery("Delete From dede_feedback where aid='$aid'");
$dsql->ExecuteNoneQuery();
if(!ereg("?",$arcurl)){
if ($num_arcurls <2){
$htmlfile = $cfg_basedir.$arcurl;
if(file_exists($htmlfile) && !is_dir($htmlfile)) unlink($htmlfile);
相关DedeCms教程:
- Dedecms生成百度地图图文教程
- 织梦dedecms生成下拉式友情链接列表
- DEDECMS使用拼音首字母做栏目名称
- 织梦DEDECMS站群增强版 DedeCMS搭建站群首选
- DedeCMS Error:Tag disabled:php错误的完整处理方法
- dedecms编码转换方法 gbk转UTF-8,UTF-8转GBK
- 防XSS,sql注射,代码执行,文件包含的通用代码
- DedeCms教程:优化DedeCMS搜索结果
- DedeCms教程:Linux+Apache+PHP+MySQL服务器环境(CentOS篇)
- DedeCms教程:LuManager服务器管理软件安装DEDECMS软件
- DedeCms教程:Ubuntu/Debian上安装 PHP 5.3, Nginx 和 PHP-fpm
- DedeCms教程:windows server 2003 php 环境搭建