我正在为管理员侧边栏创建手风琴布局.现在我需要识别活动链接,并添加一个活动的类到该链接.这是我的代码:
<div class="accordion-group"> <div class="accordion-heading"> <a href="#collapseSeven" data-parent="#side_accordion" data-toggle="collapse" class="accordion-toggle"> <i class="icon-th"></i> Gallery Manager </a> </div> <div class="accordion-body collapse" id="collapseSeven"> <div class="accordion-inner"> <ul class="nav nav-list"> <li> <?PHP echo $this->Html->link('View All',array('controller' => 'gallaries','action' => 'index'));?> </li> <li> <?PHP echo $this->Html->link('Add New','action' => 'add'));?> </li> </ul> </div> </div> </div>
什么是最好的方法呢?提前致谢!
我找到了解决方案:
$url = $this->Html->url('INPUT_THE_URL') ; $active = $this->request->here == $url? true: false;