织梦DEDECMS显示和内容洧關的专题标题内容
打开include/extend.func.php,在最后添加:
更多精彩就在: 51免费论文网|www.jxszl.com
functiongetlikespc($keywords=0)
{
global$cfg_basehost,$dsql;
$key=array();
$key=explode(",",$keywords);
$likesql;
$len=count($key);
for($i=0;$i<$len;$i++){
$now=$len-$i;
if($now==I.){
$likesql.="keywordslike%".$key[$i."%";
}else{
$likesql.="keywordslike%".$key[$i."%or";
}
}//关键字分割检索,拼接查询语句
$getsql="SELECT*fromdede_archiveswheredede_archives.channel=-I.
and$likesqlorderbydede_archives.id";//查询与该文章关键字相同的专题
//echo$getsql;
$toback;
$dsql->Execute("m",$getsql);
while($row=$dsql->GetObject(m))
{
$title=$row->title;//专题标题
$id=$row->id;//专题ID
$toback="
}
return$toback;//返回文章链接
}
{dede:field.keywordsfunction=getlikespc(@me)/}然后在你想调用相关专题的地方加入下面代码即可:
原文链接:http://www.jxszl.com/biancheng/dedecms/75408.html
热门阅读