gospodinove gospodinove - 29 days ago 7
HTML Question

database prints html tags as text instead of using them

I'm using a WYSIWYG editor but after sending the data to the database, it displays the html tags as if they were a part of the text. I'm using Laravel 5 and this purifier. I don't know if this is relative but after outputing the data from the database in the WYSIWYG editor the html tags are still displayed as text. Thank you for your help in advance.

Answer

By default, Blade {{ }} statements are automatically sent through PHP's htmlentities function to prevent XSS attacks. If you do not want your data to be escaped, you may use the following syntax:

{!! $variable !!}

Also, checkout the documentation:

https://laravel.com/docs/5.3/blade#displaying-data