Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.

How can I display a string that contains HTML tags in a twig template?

My PHP variable contains this htmlHTML and text:

$word = '<b> a word </b>'; 

When I do this in my twig template:

{{ word }} 

I get this:

&lt;b&gt; a word &lt;b&gt; 

I want this instead:

<b> a word </b> 

Is it possible to get this easily?

How can I display a string that contains HTML tags in twig template?

My PHP variable contains this html and text:

$word = '<b> a word </b>'; 

When I do this in my twig template:

{{ word }} 

I get this:

&lt;b&gt; a word &lt;b&gt; 

I want this instead:

<b> a word </b> 

Is it possible to get this easily?

How can I display a string that contains HTML tags in a twig template?

My PHP variable contains this HTML and text:

$word = '<b> a word </b>'; 

When I do this in my twig template:

{{ word }} 

I get this:

&lt;b&gt; a word &lt;b&gt; 

I want this instead:

<b> a word </b> 

Is it possible to get this easily?

Display a How to display string that contains HTML in twig template?

added 17 characters in body; edited title
Source Link
Eric Leschinski
  • 155.3k
  • 96
  • 423
  • 337

display Display a string that contains HTML in twig template

How can I display a string that contains HTML tags in twig template?

My PHP variable contains this html and text:

$word = '<b> a word </b>'; 

When I do this in my twig template:

{{ word }} 

I get this:

&lt;b&gt; a word &lt;b&gt; 

Then I want this instead:

<b> a word </b> 

Is it possible to get this easily?

display a string that contains HTML in twig template

How can I display a string that contains HTML tags in twig template?

My PHP variable contains this:

$word = '<b> a word </b>'; 

When I do this in my twig template:

{{ word }} 

I get this:

&lt;b&gt; a word &lt;b&gt; 

Then I want this:

<b> a word </b> 

Is it possible to get this easily?

Display a string that contains HTML in twig template

How can I display a string that contains HTML tags in twig template?

My PHP variable contains this html and text:

$word = '<b> a word </b>'; 

When I do this in my twig template:

{{ word }} 

I get this:

&lt;b&gt; a word &lt;b&gt; 

I want this instead:

<b> a word </b> 

Is it possible to get this easily?

http://meta.stackoverflow.com/q/137230/182741
Source Link
j0k
  • 22.8k
  • 28
  • 81
  • 90
Loading
change tags
Link
Gildas Ross
  • 3.9k
  • 5
  • 24
  • 31
Loading
Source Link
Gildas Ross
  • 3.9k
  • 5
  • 24
  • 31
Loading