注册 登录 欢迎您到模板精:织梦模板_dede模板_免费网站模板_网站源码下载

织梦教程_免费织梦模板下载_dede模板

该栏目分享织梦建站的基础知识,从织梦CMS的安装,到织梦标签的常规调用,以及织梦的常见问题答疑都有涉及。

当前位置:首页 > 织梦教程 >

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

免费网站模板 2020-09-17 10:54 织梦教程 评论
修改:dedection目录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("/