Blogger Information
Blog 30
fans 0
comment 0
visits 23416
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
ThinkPHP项目学习之实现导航栏的点击自动高亮
深海巨兽皮皮虾的博客
Original
2257 people have browsed it

先上导航模板代码:

{voList name="cateList" id="cate"}
<li
        {eq name="$Request.param.cate_id" value="$cate.id"}
        class="active"
        {/eq}
><a href="{:url('index/index',['cate_id'=>$cate.id])}">{$cate.name}</a></li>
{/voList}

    voList 为循环输出栏目

    每个栏目标题使用 a 标签包含当点击时触发 URL方法

{:url('index/index',['cate_id'=>$cate.id])}

    参数一 为跳转 到默认控制器下

    参数二 为当前栏目ID参数,该参数 不是get 与post,模板与后台都可获得该参数

http://www.qqlive.io/index.php/index/index/index/cate_id/3.html

    通过 eq标签 获取请求参数 与当前是否一致,当一致时 设置 class="active";


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