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.
            Asked
            
        
        
            Active
            
        
            Viewed 1,752 times
        
    0
            
            
         
    
    
        Storm Parker
        
- 583
- 3
- 7
- 21
- 
                    1Version of Laravel? If > 5, it's `{!! $var !!}}`. Otherwise if < 5 it's `{{{ $var }}}` – Ohgodwhy Dec 20 '16 at 23:35
- 
                    1All to it, including links to Laracasts: http://stackoverflow.com/questions/29253979/laravel-5-display-html-with-blade – Damaged Organic Dec 20 '16 at 23:56
1 Answers
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