国产无码高清视频|亚洲午夜无码专区|激情狼友国产在线|偷拍天堂AⅤII|无码流畅福利视频|久久精品最佳免费|成人av一区在线|国产一区二区嗯嗯|蜘蛛成人情侣自拍|老熟女一区=区三

B2B2C外貿(mào)商城獨立站_跨境電商解決方案
當前位置:米邦科技 > 教程技巧 > dedecms織夢列表頁內(nèi)容頁欄目高亮和當前欄目調(diào)用二級三級欄目

dedecms織夢列表頁內(nèi)容頁欄目高亮和當前欄目調(diào)用二級三級欄目

在給客戶做網(wǎng)站的時候,有一個需求:點擊產(chǎn)品二級子類的時候顯示當前欄目的三級產(chǎn)品類目,同時二級欄目和三級欄目都加current高亮顯示,效果如下圖所示:

織夢三級欄目調(diào)用

1、打開 \include\taglib\channelartlist.lib.php 找到

$tpsql = " reid='$typeid' AND ispart<>2 AND ishidden<>1 ";

改成

if($type=='son')
{
    $typeid = ( !empty($refObj->TypeLink->TypeInfos['id']) ?  GetTopid($refObj->TypeLink->TypeInfos['id']) : 0 );
    $tpsql = " reid='$typeid' AND ishidden<>1 ";
}
else
{
    $tpsql = " reid='$typeid' AND ispart<>2 AND ishidden<>1 ";
}

2、打開 \include\taglib\channel.lib.php 找到

if($type=='son' && $reid!=0 && $totalRow==0)

改成

if($type=='son' && $reid!=0 && $totalRow==0 && $noself=='')

3、后臺-系統(tǒng)-其它選項 去掉php

4、列表頁和內(nèi)容頁 標簽寫法

<style type="text/css">
.subnav2{ display:none}
</style>
{dede:php}
$GLOBALS['thisid'] = intval($refObj->Fields['typeid']);
$GLOBALS['reid'] = intval($refObj->Fields['reid']);
$GLOBALS['topid'] = intval($refObj->Fields['topid']);
{/dede:php}
{dede:channelartlist type=son}
 <li{dede:field.typeid runphp=yes}(@me==$GLOBALS['thisid']||@me==$GLOBALS['reid']||@me==$GLOBALS['topid'])? @me=' class="current"':@me='';{/dede:field.typeid}>
  <a href='{dede:field.typeurl/}'>{dede:field.typename/}</a>
 </li>
{/dede:channelartlist}
{dede:channelartlist type=son}
<div class="subnav2" style="{dede:field.typeid runphp=yes}(@me==$GLOBALS['thisid']||@me==$GLOBALS['reid']||@me==$GLOBALS['topid'])? @me=' display:block !important':@me='';{/dede:field.typeid}">
  <ul>{dede:channel type=son noself=yes}
  <a href='[field:typeurl/]'[field:id runphp=yes](@me==$GLOBALS['thisid'])? @me=' class="current"':@me='';[/field:id]>[field:typename/]</a>
{/dede:channel}</ul>
</div>
{/dede:channelartlist}

思路是subnav2默認display為none,當前二級欄目的三級再display:block顯示出來,同時各自定義current即可。

部分參考:blog.csdn.net/hlplan/article/details/77769647

標簽: dedecms 織夢 三級欄目

其他推薦 更多>>

返回
頂部