I tried rendering html markup with content that I have from the database. It's a bunch of text with a simple <a>
tag.
this is how it's set in the database field. The database fieldtype is varchar(200)
and the collation is utf8_unicode_ci
This is the value of the field:
blablabla <a href="mailto:info@atmox.nl">info@atmox.nl</a> blablabla
I tried using only the {!! !!}
blade syntax, but it would just render the markup as plain text. eventually I tried the html_entity_decode
and htmlspecialchars_decode
functions, but it's results are the same. plain text.
this is the html part
<p>{!! $baan->descriptiond !!}</p>
Try to render using htmlentities($baan->descriptiond)
, html_entity_decode($string)
on your data and then use {{ $baan->descriptiond }} to render html.
OR
just use a plain laravel blade:
{{$baan->descriptiond}}
You really should be able to do this:
<p>{!! html_entity_decode($baan->descriptiond) !!}</p>
That is assuming $baan->descriptiond
is something like:
<a href="mailto:info@atmox.nl">info@atmox.nl</a>
you need to do this way
{!! $text !!}
string will auto escape when you perform {{ }}
For laravel 5
{!!html_entity_decode($text)!!}