【phpcms v9】调用多个指定导航并添加当前页高亮

做网站时用的到的简单的栏目导航()

phpcms多个栏目catid in(9,10,11)可以修改id

排序order by listorder ASC/DESC

{if}...{/if}为判断点击为栏目

下面是一种例子:

<div style="width:1000px;height:45px;background:#067300" class="dh">
<ul>
<li class="navb"><a href="{siteurl($siteid)}" {if !$catid}class="hover"{/if} class="nhome">网站首页</a></li>
{pc:get sql="select * from v9_category where catid in(9,10,17,11,12,13,14,15) order by listorder ASC" siteid="$siteid"  return="data"}
    {loop $data $r}
<li class="navb"><a href="{$r[url]}" {if $catid == $r[catid] || $top_parentid == $r[catid]} class="hover"{/if} class="nabout">{$r[catname]}</a></li>
    {/loop}
{/pc}
</ul>
</div>

css

.navb{float: left;
     height: 38px;
     line-height: 38px;
     margin-top: 4px;
     width: 99px;}

.nabout{color:#fff; 
       font-size:14px; 
       display:inline-block; 
       width:99px; 
       text-align:center; 
       text-decoration:none;
       height:38px;line-height:38px;
       font-weight:bold;
       }
.nabout:hover{width:99px;
       color:#067300; 
       background:url(navb.jpg) repeat-x;
       display:inline-block; 
       height:45px;line-height:38px; 
       text-decoration:none;  
       margin:0px; font-weight:bold;}

.nhome{width:99px;
      color:#fff; 
      /*background:url(navb.jpg) repeat-x;*/
      display:inline-block; 
      height:45px;line-height:38px; 
      margin:0px;
      text-decoration:none;
      font-size:14px;font-weight:bold;
      }
.nhome:hover{text-decoration:none;
      display:inline-block; 
      width:99px; 
      color:#067300; 
      font-size:14px;
      background:url(navb.jpg) repeat-x;
      height:45px; 
      line-height:38px;font-weight:bold;
      }
.hover{width:99px;
       color:#067300; 
       background:url(navb.jpg) repeat-x;
       display:inline-block; 
       height:45px;line-height:38px; 
       text-decoration:none;  
       margin:0px; font-weight:bold;
       font-size:14px;}
       
.hover:hover{text-decoration:none;
      display:inline-block; 
      width:99px; 
      color:#067300; 
      font-size:14px;
      background:url(navb.jpg) repeat-x;
      height:45px; 
      line-height:38px;font-weight:bold;
      }

效果:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值