欢迎您光临深圳塔灯网络科技有限公司!
电话图标 余先生:13699882642

DEDE设置根据文章标题自动获取tag的方法

发表日期:2017-12 文章编辑:小灯 浏览次数:1255

DEDE设置根据文章标题自动获取tag的方法:

修改:\dede\action目录article_add_action.php文件

在【//写入Tag索引】与【InsertTags($dsql,$tag,$arcID,0,$typeid,$arcrank);】之间插入:

if($autokey==1){
require_once(DEDEADMIN."/../include/pub_splitword_www.php");
$tag = "";
$sp = new SplitWord();
$titleindexs = explode(" ",trim($sp->GetIndexText($sp->SplitRMM($title))));
//$allindexs = explode(" ",trim($sp->GetIndexText($sp->SplitRMM(Html2Text($body)),200)));
if(/*is_array($allindexs) && */is_array($titleindexs)){
foreach($titleindexs as $k){
if(strlen($tag)>=50) break;
else $tag .= $k." ";
}
/*foreach($allindexs as $k){
if(strlen($keywords)>=50) break;
else if(!in_array($k,$titleindexs)) $keywords .= $k." ";
}*/
}
$sp->Clear();
unset($sp);
//$tag = preg_replace("/#1#|#2#/","",$tag);
$tag = addslashes($tag);
}

1 等于 p

2 等于 e

分页干扰 所以替换

默认只对文章标题分词,要想加入内容分词请删除注释!


本页内容由塔灯网络科技有限公司通过网络收集编辑所得,所有资料仅供用户参考了本站不拥有所有权,如您认为本网页中由涉嫌抄袭的内容,请及时与我们联系,并提供相关证据,工作人员会在5工作日内联系您,一经查实,本站立刻删除侵权内容。本文链接:https://dengtar.com/8128.html
相关cms文章
    SQL执行错误,请检查