Reputation: 17
I have a code <span>{{ trans('lang.color.' . $bet->color) }}</span></div>
which displays the bet amount for a specific color.
My lang file:
'color' => [
'red' => 'red',
'zero' => 'green',
'black' => 'black',
],
Which is responsible for the fact that if the bet was placed on red, the site will say: set to red.
How can I correctly display HTML code in color variables? For example, if i write 'red' => '<div style="font-color:#FF0000">red</div>'
site does not convert the text to HTML, and writes the div with text. How to make read text file HTML?
My laravel version: 5.1.10.
Upvotes: 0
Views: 1056
Reputation: 9303
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:
{!! trans('lang.color.' . $bet->color) !!}
Note: Be very careful when echoing content that is supplied by users of your application. Always use the double curly brace syntax to escape any HTML entities in the content.
Upvotes: 2