DEDE设置根据文章标题自动获取tag的方法:
修改:dedeaction目录article_add_action.php文件
在【//写入Tag索引】与【InsertTags($dsql,$tag,$arcID,0,$typeid,$arcrank);】之间插入:02 | require_once(DEDEADMIN. "/../include/pub_splitword_[url]www.php[/url]" ); |
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($titleindexs)){ |
08 | foreach($titleindexs as $k){ |
09 | if (strlen($tag)>=50) break ; |
19 | //$tag = preg_replace( "/#1#|#2#/" , "" ,$tag); |
20 | $tag = addslashes($tag); |
|
1 等于 p
2 等于 e
分页干扰 所以替换
默认只对文章标题分词,要想加入内容分词请删除注释!