in Laravel 5 I'm trying to disable escaping in a Blade template which currently has the following:
{{ substr($v["CONTENT"],0,140)}}
I tried with
{{ !! substr($v["CONTENT"],0,140)}}
but it returns a 1 instead of a substring of text of 140 characters. I cannot move the substr functions inside a controller because I'm inside of a loop:
@foreach($articleList as $k => $v)
any idea?
You need to use {!!
and !!}
to display unescaped data. There must not be any space between the curly brace and the exclamation points.
You're getting a 1
because your blade tags are wrong, and your !!
is being treated as two not
operators, which is equating to {{ true }}
.
You want:
{!! substr($v["CONTENT"], 0, 140) !!}