打開include/extend.func.php文件
在最下面加入
/*author:格展網(wǎng)絡(luò)
*function:檢索和當(dāng)前頁面關(guān)鍵字相同的專題頁面
*time:2011.07.08 www.j4240.cn
*/
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 “;
}
}//關(guān)鍵字分割檢索,拼接 查詢語句
$getsql = “SELECT * from  idea_archives where idea_archives.channel=’-1′ and $likesql order by  idea_archives.id “;//查詢與該文章關(guān)鍵字相同的專題
//echo $getsql;
$toback;
$dsql->Execute(“m”,$getsql);
while($row = $dsql->GetObject(‘m’))
{
$title = $row->title;//專題標(biāo)題
$id = $row->id;//專題ID
$toback = “<a href=’”.$cfg_basehost.”/special/arc-”.$id.”.html’ >”.$title.”</a>”;
}
return $toback;//返回文章鏈接
}
前端調(diào)用
{dede:field.keywords function=’getlikespc(@me)’/}