Skip to content Skip to sidebar Skip to footer

Why Is One Type Of Parsed String Echoed In The Wrong Place?

I'm working on a format toolbar on a website that uses BBCode, and use the following code to parse certain formatting tags before echoing my content: $content = htmlspecialchars($r

Solution 1:

You have correctly debugged the problem by saying if I view the source code for the page it appears to be echoed correctly, but this isn't the case in the inspector,

The HTML inspector is NOT the HTML used to generate the page, but is how the browser has managed to determine what needs to be shown.

If you look at the specs for "P" elements - https://developer.mozilla.org/en-US/docs/Web/HTML/Element/p - you'll see that if you follow <p> with <blockquote> then it assumes the <p> is closed, thus you'll see in the inspector <p></p><blockquote>blah</blockquote> (followed by a </p> that it doesn't know what to do with and may use or may have discarded and may or may not show in inspector - not really sure).


Post a Comment for "Why Is One Type Of Parsed String Echoed In The Wrong Place?"