功能:删除文章的同时自动删除生成的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); } else { for($i=0;$i<=$num_arcurls;$i ){ $htmlfile = $cfg_basedir.$arcurls[$i]; if(file_exists($htmlfile) && !is_dir($htmlfile)) unlink($htmlfile);} } } }//foreach (责任编辑:laiquliu) |