导航
当前位置:网站首页 > 站长新闻 > CMS教程 > 织梦设置根据文章标题自动获取tag标签的方法

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

作者:达特 日期:2023-05-15 分类:CMS教程

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

修改:\dede\action目录article_add_action.php文件 
在【//写入Tag索引】与【InsertTags($dsql,$tag,$arcID,0,$typeid,$arcrank);】之间插入:

01 if($autokey==1){
02     require_once(DEDEADMIN."/../include/pub_splitword_www.php");
03     $tag = "";
04     $sp = new SplitWord();
05     $titleindexs = explode(" ",trim($sp->GetIndexText($sp->SplitRMM($title))));
06     //$allindexs = explode(" ",trim($sp->GetIndexText($sp->SplitRMM(Html2Text($body)),200)));
07     if(/*is_array($allindexs) && */is_array($titleindexs)){
08         foreach($titleindexs as $k){
09             if(strlen($tag)>=50) break;
10             else $tag .= $k." ";
11         }
12         /*foreach($allindexs as $k){
13             if(strlen($keywords)>=50) break;
14             else if(!in_array($k,$titleindexs)) $keywords .= $k." ";
15      }*/
16     }
17     $sp->Clear();
18     unset($sp);
19     //$tag = preg_replace("/

猜你还喜欢

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论: