效果圖:
是這篇《》的改進(jìn)版,支持所有自定義字段輸出
貼上調(diào)用實例代碼:
<div class="guess"> <h3>猜你喜歡</h3> <ol class="clearfix"> {dede:tag row='4' sort='new' getall='0'} <li [field:array runphp=yes] ($GLOBALS[autoindex]==1) ? @me="class='on'":@me="";[/field:array]>[field:tag /]</li> {/dede:tag} </ol> {dede:tag row='4' sort='new' getall='0'} <ul class="clearfix" [field:array runphp=yes] ($GLOBALS[autoindex]==1) ? @me="style='display: block'":@me="style='display:none'";[/field:array]> <li class='first'> <a class='pic' href='[field:global.cfg_basehost/][field:id function='mbp_tag_url(@me)'/]'><img src='[field:global.cfg_basehost/][field:id function='mbp_tag_img(@me)'/]' alt='[field:tag /]'></a> <h5><a href='[field:global.cfg_basehost/][field:id function='mbp_tag_url(@me)'/]' title='[field:tag /]'>[field:tag /]</a></h5> <p>[field:id function='mbp_tag_description(@me)'/]</p> </li> [field:tag runphp=yes] global $dsql,$id,$aid; $myid = isset($id) ? $id : $aid; $taga = @me; $arow = $dsql->GetOne("Select * From `dede_tagindex` where tag like '$taga'"); $tid = $arow['id']; if($tid!='') { $tagsql = "Select aid From `dede_taglist` where tid = $tid And arcrank > -1 group by aid order by aid desc"; $dsql->SetQuery($tagsql); $dsql->Execute('t'); $result = ''; while($arow = $dsql->GetArray('t')) { $ids[] = $arow['aid']; } } if(count($ids) > 0) { $idsStr = join(',', $ids); $query = "Select arc.*,addf.*,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 left join dede_addonarticle addf on arc.id = addf.aid where arc.arcrank>-1 and arc.id in($idsStr) And arc.id<>$myid order by arc.id desc limit 9";//輸入多少個文章 } $dsql->SetQuery($query); $dsql->Execute('t'); $result = ''; $totalRow = $dsql->GetTotalRow(); while($row = $dsql->GetArray('t')) { global $cfg_basehost; $arcurl = GetOneArchive($row['id']); $result .= "<li><a class='pic' href='$cfg_basehost{$arcurl['arcurl']}'><img src='$cfg_basehost{$row['litpic']}' alt='{$row['title']}'></a> <h5><a href='$cfg_basehost{$arcurl['arcurl']}' title='{$row['title']}'>{$row['title']}</a></h5> <p>作者:{$row['zuozhe']}</p> <p><em>{$row['typename']}</em></p> </li>"; } if($result=='') $result = "<p style='color:#f00;'>該TAG標(biāo)簽沒有相關(guān)文章</p>"; @me = $result; [/field:tag] </ul> {/dede:tag} </div>
要讓tag標(biāo)簽支持自增函數(shù)autoindex,還需要開發(fā)下,可以參考《》
[field:id function='mbp_tag_description(@me)'/] 這些tagindex表里自定義字段的調(diào)用可以參考《》
版權(quán)聲明: 本站資源均來自互聯(lián)網(wǎng)或會員發(fā)布,如果侵犯了您的權(quán)益請與我們聯(lián)系,我們將在24小時內(nèi)刪除!謝謝!
轉(zhuǎn)載請注明: 織夢文章頁每個tag標(biāo)簽單獨輸出相關(guān)文章(支持自定義字段)