織夢模板channelartlist實現高亮并且讓嵌套標簽里的channel也支持currentstyle高亮,這個效果很多童鞋可能沒有遇見過,但是真是做織夢模板的用戶早晚都會碰到,尤其是一些目錄比較深的網站經常會碰到,如何實現呢?
一、dede:channelartlist當前欄目高亮實現教程
打開 /include/taglib/channelartlist.lib.php 找到
$pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]);
在它下面加入
if($typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['id'] || $typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['reid'] || $typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['topid'] || $typeids[$i]['id'] == GetTopid($refObj->TypeLink->TypeInfos['id']) ){$pv->Fields['currentstyle'] = $currentstyle ? $currentstyle : 'current';}else{$pv->Fields['currentstyle'] = '';}然后 dede:channelartlist 標簽里是高亮標簽調用是
{dede:field.currentstyle/}嵌套標簽
<div class="nav"> <ul> {dede:channelartlist row=7 typeid=top currentstyle=current} <li class="{dede:field.currentstyle/}"> <a href="{dede:field.typeurl/}">{dede:field.typename/}</a> <ul> {dede:channel type='son' noself='yes' row='10' currentstyle="<li class='hover'><a href='~typelink~'>~typename~</a></li>"} <li><a href="[field:typeurl/]">[field:typename/]</a></li> {/dede:channel} </ul> </li> {/dede:channelartlist} </ul></div>實現教程
打開 /include/taglib/channel.lib.php 找到
global $dsql;
改成
global $dsql,$_sys_globals;
繼續找到
$row['id']==$typeid
改成
$row['id']==$typeid || $row['id']==$_sys_globals['typeid']以上就是織夢模板channelartlist實現高亮并且讓嵌套標簽里的channel也支持currentstyle高亮的全部內容,希望對大家的學習和解決疑問有所幫助,也希望大家多多支持武林網。
新聞熱點
疑難解答