前端经验

DUXCMS2.x三级导航高亮代码

DUXCMS2.x 三级导航高亮代码   喜欢的可以收藏下   

<!--channel:{$model="MenuList" $classId=$topCategoryInfo['class_id'] $limit="10"}-->
  <dl class="list-none">
    <dt {if="$channel['class_id']==$topCategoryInfo['class_id']"} class="on"{/if}><a href="{$channel.url}" title="{$channel.name}"><span>{$channel.name}</span></a></dt>
    <!--list:{$model="MenuList" $parentId=$channel['catalog_id'] $limit="10"}-->
    <dd>
      <h3 {if="$list['class_id']==$categoryInfo['class_id'] || $list['class_id']==$parentCategoryInfo['class_id']"} class="on"{/if}><a href="{$list.url}" title="{$list.name}"><span>{$list.name}</span></a></h3>
      <!--submenu:{$model="MenuList" $parentId=$list['catalog_id'] $limit="10"}-->
      <h4 {if="$submenu['class_id']==$categoryInfo['class_id']"} class="on"{/if}><a href="{$submenu.url}" title="{$submenu.name}"><span>{$submenu.name}</span></a></h4>
      <!--{/submenu}--> 
    </dd>
    <!--{/list}-->
  </dl>
  <!--{/channel}-->


以下是经过"不会编程的大叔"精简过的代码

<!--channel:{$model="MenuList" $classId=$topCategoryInfo['class_id'] $limit="10"}-->
<div {if="$channel['class_id']==$topCategoryInfo['class_id']"} class="u-crt"{/if}><a href="{$channel.url}" title="{$channel.name}">{$channel.name}</a></div>
<!--list:{$model="MenuList" $parentId=$channel['catalog_id'] $limit="10"}-->
<div {if="$list['class_id']==$categoryInfo['class_id'] || $list['class_id']==$parentCategoryInfo['class_id']"} class="u-crt"{/if}><a href="{$list.url}" title="{$list.name}">{$list.name}</a></div>
<!--submenu:{$model="MenuList" $parentId=$list['catalog_id'] $limit="10"}-->
<div {if="$submenu['class_id']==$categoryInfo['class_id']"} class="u-crt"{/if}><a href="{$submenu.url}" title="{$submenu.name}">{$submenu.name}</a></div>
<!--{/submenu}-->
<!--{/list}-->
<!--{/channel}-->


Powered By Z-BlogPHP 1.5 Zero

Copyright webexp.cn Rights Reserved.

本站基于 阿里云服务器 + Ename域名 + Z-Blog 构建   |   站点地图   |   辽ICP备13003381号-4