聯(lián)系官方銷售客服
1835022288
028-61286886
大家好,我想問下,這個相關(guān)調(diào)取{related module=news tag=中國,美國 num=55}
是調(diào)取的標(biāo)題包含中國,或者美國的文章。
有沒有辦法調(diào)取出標(biāo)題包含中國并且包含美國的文章呢?
SQL: SELECT * FROM `dr_1_news` WHERE ((`dr_1_news`.`title` LIKE "%中國%" OR `dr_1_news`.`keywords` LIKE "%中國%") OR (`dr_1_news`.`title` LIKE "%美國%" OR `dr_1_news`.`keywords` LIKE "%美國%")) AND `dr_1_news`.`status` = 9 ORDER BY `dr_1_news`.`updatetime` DESC LIMIT 55開發(fā)模式:已關(guān)閉數(shù)據(jù)緩存:未設(shè)置分頁功能:未開啟
{php $where=urlencode(" title like '%中國%' and title like '%美國%' ");}
{module module=news where=$where num=55}
換一種方式了
where參數(shù)是萬能的,可以組裝任何sql條件
回復(fù)迅??蚣軇?chuàng)始人 這個是把關(guān)鍵詞固定的寫法,可不可以根據(jù)文章中的關(guān)鍵詞,或者字段調(diào)取呢?
比如
文章標(biāo)題:公司領(lǐng)導(dǎo)就要結(jié)婚了送什么禮物好呢
關(guān)鍵詞:領(lǐng)導(dǎo),結(jié)婚
我想調(diào)用出,標(biāo)題 包含領(lǐng)導(dǎo)和結(jié)婚的文章
當(dāng)然可以了,show.html頁面寫法可以改成這樣
{php
$arr=[];
foreach ($tags as $name=>$u) {
$arr[]= " title like '%".$name."%' ";
}
$where=urlencode(implode(" and ", $arr));}
{module module=news where=$where num=55}
回復(fù)迅??蚣軇?chuàng)始人 系統(tǒng)故障了 ??
看下錯誤錯誤日志記錄,可能是我寫錯了某個字母
回復(fù)迅??蚣軇?chuàng)始人
{module module=news where=$where num=55}