Justin
Justin

Reputation: 105

How to Include @ symbol in blade template page without it being processed as blade code in Laravel

So my dilemna is this.

<p>Email: [email protected]</p>

Is being processed as blade code and won't re-size in my responsive bootstrap web page in my Laravel 4 framework.

Any ideas on how to get blade to ignore the @ symbol? It is probably a simple fix I just can't find it on the web.

Thanks

Upvotes: 3

Views: 3286

Answers (3)

samlev
samlev

Reputation: 5942

A really simple way would be this:

someone{{'@'}}email.com

{{ $whatever }} effectively gets transformed into <?= e($whatever) ?> (where e() does HTML escaping) so you can put a string there, and that will get output instead of a variable.

Upvotes: 9

msurguy
msurguy

Reputation: 524

There are also HTML helpers in Laravel, you can use the following to generate a mailto tag with an obfuscated email address:

# Generating obsufscated mailto tag
{{ HTML::mailto('[email protected]','Some person'); }}

// Generates :
<a href="mailto:[email protected]">Some person</a>

View more of these helpers at http://www.laravel-tricks.com/tricks/generating-html-using-html-methods

Upvotes: 3

Anam
Anam

Reputation: 12169

The following will avoid blade syntax:

<p>Email: info<?php echo urldecode('%40')?> example.com</p>


%40 is equivalent to @

Upvotes: 4

Related Questions