Support the ongoing development of Laravel.io →
posted 8 years ago
Views Blade
Last updated 7 months ago.
0

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

Last updated 7 months ago.
0

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!

Last updated 7 months ago.
0

If you have same problem, this pretty much solves it http://stackoverflow.com/questions/28793614/laravel-5-link-to-...

0

This should work

{{ HTML::decode(link_to_route('logout', '<i class="fa fa-sign-out"></i> Log Out', array(), ['class' => 'small button'])) }}
Last updated 7 years ago.
0

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'])) }}
0

this work, too.. {!! HTML::decode(link_to_route('logout', ''<i class="fa fa-sign-out"></i> Log Out', array(), ['class' => 'small button'])) !!}

Last updated 6 years ago.
0

Sign in to participate in this thread!

Cloudways

Your banner here too?

cringer cringer Joined 25 Sep 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.