Laravel 4 - 刀片模板 - 如何正确链接到路线?

2022-01-08 00:00:00 php html laravel laravel-4 blade

我想用 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>

相关文章