A
A
Arman2016-01-15 18:40:21
Laravel
Arman, 2016-01-15 18:40:21

Laravel/Blade - how to escape only part?

Good evening.
According to docs
https://laravel.com/docs/master/blade#displaying-data

{{ $name }} — экранируем и выводим
{!! $name !!} — не экранируем, просто выводим

{{ isset($name) ? $name : 'Default' }} - проверка и выводим с экранированием

// а как сделать что-то вроде
{!! isset($name) ? {{ $name }} : '<span class="class-a">без имени</span>' !!}

Those. problem to use output with and without escaping together
Thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav, 2016-01-15
@Arik

Condition

@if(isset($name)) 
 {{$name}}
@else 
  <span class="class-a">без имени</span>
@endif

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question