0

New to Laravel and am currently playing with the Blade templating system. I have an issue with it parsing html. I have text data in my db with HTML tags (<p>words words words....) and when I used {!! $post->content !!} it came out the same with the tags showing. I tried clearing cache and even 3 brackets {{{ $post->content }}} but it's not working.

Storm Parker
  • 583
  • 3
  • 7
  • 21

1 Answers1

0

When you write {{ $post->content }} it's not going to work. It will show the html tag. But if you write {!! $post->content !!} it should not show the html tag, but it doesn't show the line break of course. so you need to write this one below -

{!! nl2br($post->content) !!}

It converts the newline to a <br> tag. This should perfectly work.

Afikur Rahman
  • 347
  • 2
  • 13