調(diào)用相關(guān)文章,如果是內(nèi)容頁(yè)調(diào)用則不包含當(dāng)前這一篇文章
把下面代碼放到模板你想顯示的位置
{dede:field.keywords runphp=yes}
global $dsql,$id,$aid;
$aid = isset($id) ? $id : $aid;
$keyword = '';
if(!empty(@me))
{
$keywords = explode(',' , trim(@me));
$keyword = '';
$n = 1;
foreach($keywords as $k)
{
if($n > 3) break;
if(trim($k)=='') continue;
else $k = addslashes($k);
$keyword .= ($keyword=='' ? " CONCAT(arc.keywords,' ',arc.title) LIKE '%$k%' " : " OR CONCAT(arc.keywords,' ',arc.title) LIKE '%$k%' ");
$n++;
}
}
if($keyword != '')
{
$sql = "SELECT arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath FROM `dede_archives` arc LEFT JOIN `dede_arctype` tp ON arc.typeid=tp.id where arc.arcrank>-1 AND ($keyword) AND arc.id<>'$aid' ORDER BY arc.id desc limit 0, 10";
}
$dsql->SetQuery($sql);
$dsql->Execute('t');
$result = '';
while($row = $dsql->GetArray('t'))
{
$arcrow = GetOneArchive($row['id']);
$row['arcurl'] = $arcrow['arcurl'];
$row['pubdate'] = MyDate('Y-m-d',$row['pubdate']);
$row['litpic'] = $row['litpic'] = $row['litpic']=='' ? '/images/defaultpic.gif' : $row['litpic'];
$result .= "<li><a href=\"{$row['arcurl']}\"><img src=\"{$row['litpic']}\">{$row['title']}</a></li>";
}
@me = $result;
{/dede:field.keywords}
版權(quán)聲明: 本站資源均來(lái)自互聯(lián)網(wǎng)或會(huì)員發(fā)布,如果侵犯了您的權(quán)益請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)刪除!謝謝!
轉(zhuǎn)載請(qǐng)注明: 織夢(mèng)欄目關(guān)鍵字文章關(guān)鍵字調(diào)用相關(guān)文章