打開include/extend.func.php文件
在最下面加入
/*author:格展網絡*function:檢索和當前頁面關鍵字相同的專題頁面*time:2011.07.08 m.gjgbw.com*/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 idea_archives where idea_archives.channel=’-1′ and $likesql order by idea_archives.id “;//查詢與該文章關鍵字相同的專題//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)’/}


