Laravel 4.1 Request :: is对于活动菜单不起作用

编程入门 行业动态 更新时间:2024-10-13 08:19:18
本文介绍了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对于活动菜单不起作用

本文发布于:2023-11-23 01:16:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1619585.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不起作用   菜单   Laravel   Request

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!