2014-12-03 67 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

相關問題