Laravel 4 - 刀片模板 - 如何正确链接到路由? [英] Laravel 4 - Blade Templating - How to properly Link to Route?
本文介绍了Laravel 4 - 刀片模板 - 如何正确链接到路由?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
通常我只用
{{link_to_route('Yadayadayada.route','LinkName',$ params}}
但是在这种情况下,我在这个布局中使用了一个模板:
< a href =index。 html>
< i class =icon-dashboard>< / i>
< span class =menu-text>仪表板< / span>
< / a>
这意味着在anchor标签内,还有一个< i>
-Tag和< span>
-Tag。
是否可以使用 {{link_to_route}}
-Method,而不必更改Template的布局?
>
使用 URL :: route()
来获得链接: < a href ={{URL :: route('user / profile /',$ params)}}>
< i class =icon-dashboard>< / i>
< span class =menu-text>仪表板< / span>
< / a>
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>
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?
解决方案
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屋!
查看全文