栏目列表中选中栏目醒目显示的方法

代码如下:

{mhcms $pid=gettopparentid($catid);}
{if $pid==0}
{mhcms $pid=$catid;}
{/if}
{mh:category parentid= $pid type= top }
<li {if field:id==$id || field:id==gettopparentid($id) } class= current {/if}><a href= {field:url} target= _self title= {field:catname} >{field:catname}</a></li>
{/mh:category}

通过{if field:id==$id || field:id==gettopparentid($id) } class= current {/if}设置选中栏目样式为current,只要在css中设置相应的样式即可醒目显示选中栏目。

Leave a Comment

您的邮箱地址不会被公开。 必填项已用 * 标注

Scroll to Top