Laravel 4 - 刀片模板 - 如何正确链接到路线? [英] Laravel 4 - Blade Templating - How to properly Link to Route?

查看:30
本文介绍了Laravel 4 - 刀片模板 - 如何正确链接到路线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用 Laravel 创建一个资源丰富的链接.通常我只使用 {{ link_to_route('Yadayadayada.route', 'LinkName', $params }}

I want to create a resourceful link with Laravel. Normally I just use the {{ link_to_route('Yadayadayada.route', 'LinkName', $params }}

但在这种情况下,我使用的是具有这种布局的模板:

But in this case I am using a Template with this layout:

<a href="index.html">
     <i class="icon-dashboard"></i>
     <span class="menu-text"> Dashboard </span>
</a>

这意味着在锚标记内部,还有一个 <i>-Tag 和一个 <span>-Tag.是否可以使用 {{ link_to_route }}-Method,而无需更改模板的布局?

That means that inside the anchor tag, is as well a <i>-Tag and a <span>-Tag. Is it possible to use the {{ link_to_route }}-Method, without having to change the layout of the Template?

推荐答案

使用 URL::route() 只获取一个链接:

Use URL::route() to get just a link:

<a href="{{ URL::route('user/profile/', $params) }}">
     <i class="icon-dashboard"></i>
     <span class="menu-text"> Dashboard </span>
</a>

这篇关于Laravel 4 - 刀片模板 - 如何正确链接到路线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆