
项目开发到前端遇到的一个小技巧,因为有新手朋友问过,所以在这里分享给大家。
网上的方案基本都跟js有关,都不怎么样,现在把我的方案分享一下,一听就懂,一分钟学会。
点击查看视频教程
CommonController.class.php 构造方法中执行以下方法
//栏目高亮显示
public function curr(){
$current=I('cateid'); //当前栏目的id
$this->assign('current',$current);
}在header.html导航位置写<div class="nav_main clearfix">
<a href="__APP__" class="menu <if condition="$curr">current</if>">首 页</a>
<volist name="cateres" id="vo">
<a href="__MODULE__/<if condition="$vo['type'] eq 1">List<elseif condition="$vo['type'] eq 2" />Page<else />Topic</if>/index/cateid/{$vo.id}" class="menu <if condition="$current eq $vo['id']">current</if>">{$vo.catename}</a>
</volist>
<span class="icon_hot"></span>
</div>非常简单最佳答案