织梦DEDE后台重复文档检测功能,增加结果显示文档id和文档url链接,此功能方便记录查看和删除后提交到百度删除死链,增加网站SEO功能。
效果图如下:
实现方法如下:
1、打开 /dede/templets/article_result_same.htm 找到,大概在114行
- <?php echo $row['title']; ?>
在它下面加入
- ( <?php echo $row['id']; ?> ) ( <?php $arcrow=GetOneArchive($row['id']);echo $arcrow['arcurl']; ?> ) <input name="arcIds" type="checkbox" id="arcId" value="<?php echo $row['id'];?>" style="display:none;" checked />
继续找到129行左右的
- (共有 <?php echo $allarc; ?> 篇重复标题的文档!)
在它上面加入
- <input type='button' name='bt4' value='导出全部链接' onclick='expArc()' />
- <script>
- function expArc(){
- var qstr="";
- if(document.form2.arcId.value) return document.form2.arcId.value;
- for(i=0;i<document.form2.arcId.length;i++)
- {
- if(document.form2.arcId[i].checked)
- {
- if(qstr=="")
- qstr=document.form2.arcId[i].value;
- else
- qstr=qstr+"`"+document.form2.arcId[i].value;
- }
- }
- document.form2.titles.value = qstr;
- document.form2.dopost.value = 'export';
- document.form2.submit();
- }
- </script>
2、打开 /dede/article_test_same.php 找到
- COUNT(title) AS dd,title
改成
- COUNT(title) AS dd,title,id
继续找到大概在30行
- //删除选中的内容(只保留一条)
在它上面加入
- else if($dopost=='export')
- {
- if(emptyempty($titles))
- {
- header("Content-Type: text/html; charset={$cfg_ver_lang}");
- echo "<meta http-equiv="Content-Type" content="text/html; charset={$cfg_ver_lang}"> ";
- echo "没有指定导出的文档!";
- exit();
- }
- if(isset($cfg_basehost) && $cfg_basehost != '/')
- {
- $domain = $cfg_basehost;
- }
- else
- {
- if(isset($_SERVER['HTTPS']) && ('1' == $_SERVER['HTTPS'] || 'on' == strtolower($_SERVER['HTTPS']))){
- $SERVER_PORT = 'https://';
- }elseif(isset($_SERVER['SERVER_PORT']) && ('443' == $_SERVER['SERVER_PORT'] )) {
- $SERVER_PORT = 'https://';
- }else{
- $SERVER_PORT = 'http://';
- }
- $domain = $SERVER_PORT . $_SERVER['HTTP_HOST'];
- }
- $content = "";
- $ids = split('`',$titles);
- foreach($ids as $id)
- {
- $arcrow = GetOneArchive($id);
- $content .= $domain . str_replace($domain, '', $arcrow['arcurl']) . " ";
- }
- Header("Content-type:application/octet-stream");
- Header("Accept-Ranges:bytes");
- header("Content-Disposition:attachment;filename=badlink.txt");
- header("Expires:0");
- header("Cache-Control:must-revalidate,post-check=0,pre-check=0 ");
- header("Pragma:public");
- echo $content;
- exit();
- }
修改保存后即可完成。
收藏