Hi,
as far as i know you can't use html tags with link_to_route function. So you have two options. First, you can use your first code with route($route) - it generates url for given route -. Second, you can create a new helper method something like link_to_route_icon() and use it :)
Lastly, you can learn how to write with mark up in here : http://laravel.io/forum/01-31-2014-how-to-mark-up-forum-posts
Thanks for the markdown link. I did look for that prior to posting but didn't find it. ;)
I figured as much about the html tags, as I get the same text display instead of rendered HTML using the HTML Builder. However I just thought it was pretty odd that the source shows the same code yet only one is rendered correctly.
<li class="has-form">
<a class="small button" href="http://morris.local:8000/logout">
<i class="fa fa-sign-out fa-lg"></i> Log Out
</a>
</li>
<li class="has-form">
<a class="small button" href="http://morris.local:8000/logout">
<i class="fa fa-sign-out fa-lg"></i>
Log Out
</a>
</li>
I already have a helpers.php file autoloaded using PSR-4, I'll probably go that route. Thanks for the info!
If you have same problem, this pretty much solves it http://stackoverflow.com/questions/28793614/laravel-5-link-to-with-icon-html
This should work
{{ HTML::decode(link_to_route('logout', '<i class="fa fa-sign-out"></i> Log Out', array(), ['class' => 'small button'])) }}
Thanks TorchSK Its work like a boss :D
TorchSK said:
This should work
{{ HTML::decode(link_to_route('logout', '<i class="fa fa-sign-out"></i> Log Out', array(), ['class' => 'small button'])) }}
this work, too.. {!! HTML::decode(link_to_route('logout', ''<i class="fa fa-sign-out"></i> Log Out', array(), ['class' => 'small button'])) !!}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community