# DEDECMS内容页如何增加调用相关专题的功能

*Published:* 2023-12-19
*Author:* 客服001

#### 温馨提醒

如果文章内容或图片资源失效，请留言反馈，我们会及时处理，谢谢

本文最后更新于2023年12月19日，已超过 180天没有更新



打开include/extend.func.php，在最后添加：

```
 function getlikespc($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==1){   
   $likesql .= "keywords like '%".$key[$i]."%' ";   
 }else{   
   $likesql .= "keywords like '%".$key[$i]."%' or ";   
  }   
 }//关键字分割检索,拼接 查询语句   
 $getsql = "SELECT * from  dede_archives where dede_archives.channel='-1'  
and $likesql order by  dede_archives.id ";//查询与该文章关键字相同的<a class="tag_link" href="https://www.xarjtc.com/tag/%e4%b8%93%e9%a2%98" target="_blank" title="查看专题此标签更多文章"><abbr title="">专题</abbr></a>   
 //echo $getsql;   
 $toback;   
    $dsql->Execute("m",$getsql);   
 while($row = $dsql->GetObject('m'))   
    {   
        $title = $row->title;//专题标题   
  $id = $row->id;//专题ID   
  $toback = "<a href='".$cfg_basehost."/special/arc-".$id.".html' >".$title."</a>";   
    }   
    return $toback;//返回文章链接   
}
```

然后在你想调用相关专题的地方加入下面代码即可：

```
{dede:field.keywords function='getlikespc(@me)'/}
```