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

StackOverflow https://stackoverflow.com/questions/20603554

Вопрос

So my dilemna is this.

<p>Email: info@example.com</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

Это было полезно?

Решение 2

The following will avoid blade syntax:

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


%40 is equivalent to @

Другие советы

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.

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('myemail@mail.com','Some person'); }}

// Generates :
<a href="mailto:myemail@mail.com">Some person</a>

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top