本文介绍了Laravel 4.1 Request :: is对于活动菜单不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图根据laravel 4.1中的路线激活菜单,我的尝试是:
I'm trying to make a menu active depending on route in laravel 4.1, my attempt:
<li {{{ (Request::is('/core') ? 'class="active"' : '') }}}><a href="{{{ URL::to('/core') }}}">Control Panel</a> </li>我的路线:
Route::get('/core', 'CoreController@Showindex');这不会引发任何错误,只是简单地将其忽略即可.任何帮助表示赞赏.
This is not throwing any errors just simply ignored. any help is appreciated.
推荐答案已更改为:
<li {{{ (Request::is('/core') ? 'class=active' : '') }}}><a href="{{{ URL::to('/core') }}}">Control Panel</a> </li>从'class="active"'到'class=active'
对于<li>标签而不是<a>标签,这种方法可以正常工作,需要这样使用:
This working fine for <li> tag but not <a> tag, needs to be used like so:
<a href="{{{ URL::to('core') }}}" class="list-group-item {{{ (Request::is('core') ? 'active' : '') }}}">Overview</a>更多推荐
Laravel 4.1 Request :: is对于活动菜单不起作用
发布评论