ucbug軟件站:安全、綠色、放心的專業(yè)下載站!首頁|最近更新|專題集合|標(biāo)簽云|站內(nèi)導(dǎo)航|加入收藏

dedecms織夢系統(tǒng)相關(guān)專題的調(diào)用方法

時間:2017-11-07 09:00:39來源:ucbug游戲網(wǎng)人氣:0

dedecms織夢相關(guān)專題的調(diào)用方法∵?!咴谛枰{(diào)用相關(guān)專題的地方添加:∵dede標(biāo)簽{dede:field.keywords∵function=getlikespc(@me)/}∵include/extend.func.php∵文件中添加:∵/*author:織夢的魚∵*function:檢索和當(dāng)...

dedecms織夢相關(guān)專題的調(diào)用方法 。

在需要調(diào)用相關(guān)專題的地方添加:dede標(biāo)簽{dede:field.keywords function=’getlikespc(@me)’/} 

include/extend.func.php 文件中添加:

/*author:織夢的魚

*function:檢索和當(dāng)前頁面關(guān)鍵字相同的專題頁面

*time:2011.07.08

*/

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;//返回文章鏈接

}

專題列表樣式可修改$toback的樣式

標(biāo)簽dedecms