加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > CMS系统 > Dedecms > 正文

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

发布时间:2020-12-14 05:00:49 所属栏目:Dedecms 来源:网络整理
导读:DEDE设置根据文章标题自动获取tag的方法: 修改:dedeaction目录article_add_action.php文件 在【//写入Tag索引】与【InsertTags($dsql,$tag,$arcID,$typeid,$arcrank);】之间插入: ? if($autokey==1){ ??? require_once(DEDEADMIN."/../include/pub_spli

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

修改:dedeaction目录article_add_action.php文件

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

if($autokey==1){
??? require_once(DEDEADMIN."/../include/pub_splitword_[url]www.php[/url]");
??? $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

分页干扰 所以替换

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读