dede调取当前文章关键词相同的文章(模糊匹配)的方法:
1、找到文件:/include/taglib/arclist.lib.php
找到如下内容:
//关键字条件
if($keyword!='')
{
$keyword = str_replace(',', '|', $keyword);
$orwheres[] = " CONCAT(arc.title,arc.keywords) REGEXP '$keyword' ";
}
替换为:
if($keyword!='')
{
$rowGetKeyword = $dsql->GetOne("select keywords From `dede_archives` where id='$arcid'");
$keyword=$rowGetKeyword['keywords'];
$keyword = str_replace(',', '|', $keyword);
$orwheres[] = " CONCAT(arc.title,arc.keywords) REGEXP '$keyword' ";
}
2、文章页模板写法:
{dede:arclist typeid='all' limit='0,12' titlelen=24 keyword='{dede:field name='keyword'}
<li><a href="[field:arcurl/]">[field:fulltitle/]</a></li>
{/dede:arclist}