DEDE采集时自动生成摘要和关键字

最近在学习织梦CMS的采集功能,在采集的过程我总是发现织梦5.6可以采集到内容,但不可自动生成摘要和关键字,关键字和摘要都是空的。

最近在学习织梦CMS的采集功能,在采集的过程我总是发现织梦5.6可以采集到内容,但不可自动生成摘要和关键字,关键字和摘要都是空的。感觉很遗憾,怎么办呢?

可能很多人都遇到了和我一样的问题,在论坛实在没找到好的解决办法,就自己动手去改改文件。废话不多说了。

下面是我的解决办法

比如我采集了网站:http://www.genban.org

首页的meta代码是:

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>一条龙建站 - 建站服务,建站教程,新云建站教程,织梦建站教程,CMS建站教程</title>
<meta name="description" content="一个综合建站教程、建站经验交流、织梦CMS建站技巧、CMS建站模板的站长教程网。" />
<meta name="keywords" content="建站教程,织梦建站教程,CMS建站教程" />

如果用织梦模板的采集的时候就没有办法自动获取description和keywords的值的。

1、修改 include/dedecollection.class.php

//自动分析关键字和摘要
preg_match("/<meta[\s]+name=['\"]keywords['\"] content=['\"](.*)['\"]/isU",$this->tmpHtml,$inarr);
preg_match("/<meta[\s]+content=['\"](.*)['\"] name=['\"]keywords['\"]/isU",$this->tmpHtml,$inarr2);
if(!isset($inarr[1]) && isset($inarr2[1]))
{
$inarr[1] = $inarr2[1];
}

用下面一段代码替换上面的

//自动分析关键字和摘要
preg_match("/<meta[\s]+name=['\"]keywords['\"] content=['\"](.*)['\"]/isU",$this->tmpHtml,$inarr);
preg_match("/<meta[\s]+content=['\"](.*)['\"] name=['\"]keywords['\"]/isU",$this->tmpHtml,$inarr2);
preg_match("/<meta[\s]+name=keywords content=['\"](.*)['\"]/isU",$this->tmpHtml,$inarr3);
if(!isset($inarr[1]) && isset($inarr2[1]))
{
$inarr[1] = $inarr2[1];
}
if(!isset($inarr[1]) && isset($inarr3[1]))
{
$inarr[1] = $inarr3[1];
}

改了上面的, 还有另一个地方需要修改的

preg_match("/<meta[\s]+name=['\"]description['\"] content=['\"](.*)['\"]/isU",$this->tmpHtml,$inarr);
preg_match("/<meta[\s]+content=['\"](.*)['\"] name=['\"]description['\"]/isU",$this->tmpHtml,$inarr2);
if(!isset($inarr[1]) && isset($inarr2[1]))
{
$inarr[1] = $inarr2[1];
}

用下面的代码替换掉上面的:

preg_match("/<meta[\s]+name=['\"]description['\"] content=['\"](.*)['\"]/isU",$this->tmpHtml,$inarr);
preg_match("/<meta[\s]+content=['\"](.*)['\"] name=['\"]description['\"]/isU",$this->tmpHtml,$inarr2);
preg_match("/<meta[\s]+name=description content=['\"](.*)['\"]/isU",$this->tmpHtml,$inarr3);
if(!isset($inarr[1]) && isset($inarr2[1]))
{
$inarr[1] = $inarr2[1];
}
if(!isset($inarr[1]) && isset($inarr3[1]))
{
$inarr[1] = $inarr3[1];
}

重新上传,大功告成。记得覆盖的时候一定要备份哦。

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

打开文件 /dede/inc/inc_archives_functions.php 1、在最后增加方法 /*火车头采集自动更新主页*/ function MakeIndex() { global $dsql,$cfg_basedir,$cfg_templets_dir,$cfg_df_style; require_once(DEDEINC./arc.partview.class.php); $envs = $_sys_globa
1.如何修改默认发布为动态页; 这个其实很简单,会改html就可以了!把dede文件夹打开,用编辑器打开article_add.php,找到td width=90发布选项:/td td input name=ishtml type=radio class=np value=1 checked 生成HTML input name=ishtml type=radio class
关于面包屑导航栏目链接相对路径的修改方法 好吧,自己解决了,现在写出来,希望可以帮到有同样问题的人。 找到/include/typelink.class.php 然后找到下面代码,大概在196行的位置 function GetOneTypeLink($typeinfos) { $typepage = $this-GetOneTypeUrl($
织梦后台默认生成更新RSS文件是按照网站栏目生成告诉用户每个栏目的RSS订阅地址,保存在data目录下,按分类生成很适合栏目或栏目文章较多的dedecms站点,小型CMS站点偏向于生成一个全站的RSS 文件,下面的方法可以实现dedecms只生成一个rss.xml文件夹保存于
有时候,我们在用dedecms建网站的时候,在图片集内容页需要调用当前文章的所有图片出来,这个时候就需要在内容页吧网站里面的所有图片都调用出来了,该怎么做呢?下面看具体步骤: 第一步: 打开include/extend.func.php,在后面加入以下代码 复制代码 functi
dedecms获得某篇文章内容的几种方法,在这里给大家总结了以下三种方法: 1. 使用SQL {dede:sql sql=Select body from `dede_addonarticle` where aid=146} [field:body/] {/dede:sql} 2.使用arclist, 用idlist获取,aid 是没用的,在首页记得要获取typeid,