时时商务社区
标题:
dedecms根据文章标题自动获取tag
[打印本页]
作者:
yj1281
时间:
2018-2-13 20:41
关键字描述:获取 自动 标题 根据 文章   " tag sp-> if
图片:
=700) window.open('http://files.jb51.net/file_images/cms/2009661545957877801.jpg');" src="http://files.jb51.net/file_images/cms/2009661545957877801.jpg" onload="if(this.width>'700')this.width='700';" border="0" alt="" />
图片:
=700) window.open('http://files.jb51.net/file_images/cms/2009661545964077802.jpg');" src="http://files.jb51.net/file_images/cms/2009661545964077802.jpg" onload="if(this.width>'700')this.width='700';" border="0" alt="" />
图片:
=700) window.open('http://files.jb51.net/file_images/cms/2009661545968777803.jpg');" src="http://files.jb51.net/file_images/cms/2009661545968777803.jpg" onload="if(this.width>'700')this.width='700';" border="0" alt="" />
看到论坛上有人跟我一样有这个需要,就尝试着弄了下,经测试可以根据文章标题自动获取tag
我对php不熟悉,是瞎改的,不知道会不会有什么其他影响,修改请慎重……
修改:\dede\action目录article_add_action.php文件
在【//写入Tag索引】与【InsertTags($dsql,$tag,$arcID,0,$typeid,$arcrank);】之间插入:
Copy code
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
下一页
阅读全文
欢迎光临 时时商务社区 (http://bbs.4435.cn/)
Powered by Discuz! X3.2