Display BD text in a div considering the HTML tags contained in this text

Asked

Viewed 56 times

-1

Speak guys, I have a text written in BD Mysql where, this text already contains all the formatting tags.

On my font-end page, I receive this text through a foreach and pass it in a div of the page, however, it is not reflecting the formatting of the tags, the tags are coming as text.

Example of the text contained in the BD’s article table: inserir a descrição da imagem aqui

Here is my div who will receive this content:

<div data-content="html"><%= row.artigo %></div>

And here as it is being displayed on the page: inserir a descrição da imagem aqui

  • Try it this way: <%=html_entity_decode(row.artigo) %>.

1 answer

0


Change the <%= row.artigo %> for <%- row.artigo %>

The difference is that the <%- passes the data exactly as it is, in its "raw" format, without doing any parse or encounter, and as they already come as html bank, will be shown correctly on the page.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.