I have some strings that contain fairly simply html code, for example:
"<p>This is the <b>first paragraph</b></p><p> this is the second</p>"
The tags are generally limited to things like <p>, <b>, <u>, <em> etc. I'd like to be able to 'preview' this string to the user by only showing the first line. In the above code, for example, '<p>This is the <b>first paragraph</b></p>'. If it was plain text,
I'd just use substr to get say the first 80 characters, but with the html formatting some of the characters will be hidden since they are mark-up. There's also the problem that the substring might not contain balanced tags, eg "<p>This is the <b>first paragraph<"
Any ideas how I'd do this? Perhaps the solution is not PHP, but somehow to use overlapping <div> to hide all the but first line?