Forum Moderators: coopster
I've got to the stage where the data stored in the database in 100% correct.
My problem is converting line breaks to <br /> and <p></p>.
An example database stored entry:
<h2>A Testing title!</h2>A list:
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
Another paragraph.
This is how I'd like it to be displayed to viewers:
<h2>A Testing title!</h2><p>A list:</p>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
<p>Another paragraph.</p>
I've tried: nl2br and replacing double '<br />' to '</p><p>', but this messes up the HTML lists and sometimes H tags.
What I really want is a nl2br function that doesn't work between block level elements.
Can anyone point me in the right direction?