2014-12-03 64 views
0

我不能做这样的事情: <a href="/home/add" class="btn btn-success"><i class="glyphicon glyphicon-plus"></i> Create new Gallery</a>Laravel,如何添加glyphicon?

我有这个,我不知道什么是未来:

{{ link_to('video' ~ '/edit/' ~ video.id, trans('gallery.create'), {'class': 'btn btn-success'})}} 

我需要这个 - ><i class="glyphicon glyphicon-plus"></i>添加到我的link_to。 请帮忙。

+0

你有这条链接的命名路线吗?如果是这样,请使用Laravel的帮助类 Th3Alchemist 2014-12-03 10:27:16

+0

any other ideas? – Jensej 2014-12-03 10:59:04

+0

Are you talking PHP for sure? – 2014-12-03 11:55:39

回答

0

您可以使用URL::to('/home/add')获得的,而不是使用的link_to()只是一个链接:

<a href="{{ URL::to('/home/add') }}" class="btn btn-success"> 
    <i class="glyphicon glyphicon-plus"></i> Create new Gallery 
</a> 
+0

Unexpected token "punctuation" of value ":" ("end of print statement" expected) – Jensej 2014-12-03 10:14:17

0

您应该为您的路线,这是很好的做法,因为如果你更改网址,你那么只需要改变在您的routes.php文件中。

Route::get('/home/add', ['uses' => '[email protected]', 'as' => 'home.add']);

然后,你可以使用{{ URL::route('home.add') }}

<a href="{{ URL::route('home.add') }}" class="btn btn-success"> 
<i class="glyphicon glyphicon-plus"></i> 
Create new Gallery 
</a> 

如果您需要发送一些$ id或什么的链接,然后{{ URL::route('home.add', ['just put those parameters in here']) }}

除此之外,我没有办法通过link_to的$ title来获得glyphicon html而没有被转义。

+0

add in routes.php 'Route::get('/foto/create', array('as' => 'foto.create', 'uses' => '[email protected]'));' and in viws/nam.twig add this: ' \t ' \t Create new Gallery \t',并且仍然有错误:“意外的标记”标点符号“value”:“(”end of print statement“expected)' – Jensej 2014-12-03 11:27:07

+0

'foto.create',您现在命名为'no' /'但是''。' :''as'=>'foto.create''。 '' – 2014-12-03 11:30:58

相关问题