Skip to main content
 Web开发网 » 站长学院 » 织梦教程

织梦当前栏目调用二级、三级栏目且栏目高亮解决方法

2020年09月12日7250百度已收录

在处理企业站的时候,经常发现要调用二三级栏目栏目,且需要高亮显示,具体实现方法如下。

 

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、后台-系统-其它选项 模板引擎禁用标签 去掉php 

 

调用代码如下:

 

<ul>

{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>

    <ul>

    {dede:channel type=son noself=yes}

    <li[field:id runphp=yes](@me==$GLOBALS['thisid'])? @me=' class="current2"':@me='';[/field:id]><a href='[field:typelink /]' title='[field:typename/]'>[field:typename/]</a></li>

    {/dede:channel}

    </ul>

{/dede:channelartlist}

</ul>

至此,全部完成。


 

评论列表暂无评论
发表评论
微信