Blogger Information
Blog 48
fans 2
comment 3
visits 37440
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
织梦channelartlist实现高亮显示
黑猫警长的博客
Original
751 people have browsed it

要求实现:dede:channelartlist 高亮显示

{dede:channelartlist typeid='top'}
<li class="drop active"><a href="{dede:field name='typeurl'/}">{dede:field name='typename'/}</a>
  <ul class="drop-down">
    {dede:channel type='son'}
    <li><a href='[field:typelink/]'>[field:typename/]</a></li>
    {/dede:channel}
  </ul>
</li>
{/dede:channelartlist}

解决方案:

1:修改/include/taglib/channelartlist.lib.php文件。

找到:$pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]);

在此行代码下方增加以下代码:

if($typeids[$i]['id'] == $refObj->TypeLink->TypeInfos['id']){ 
    $pv->Fields['currentstyle'] = 'active'; 
}else{
    $pv->Fields['currentstyle'] = '';
}

注意:active 这个是你的CSS里要设置的高亮显示样式。

 

2:模板标签代码为:

{dede:channelartlist typeid='top'}
<li class="drop {dede:field name='currentstyle'/}"><a href="{dede:field name='typeurl'/}">{dede:field name='typename'/}</a>
  <ul class="drop-down">
    {dede:channel type='son'}
    <li><a href='[field:typelink/]'>[field:typename/]</a></li>
    {/dede:channel}
  </ul>
</li>
{/dede:channelartlist}

 

看下代码有何不同?分享下教程,帮助更多的织梦爱好者。


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!