I need to get a short excerpt of news items written in HTML to show on my front page. Obviously I can't use something as simple as substr
because it might leave tags unclosed or even leave half a tag.
Which is easier:
- Converting the HTML to decent looking plain text and take a piece of that
- Taking the beginning from the HTML and closing any unclosed tags at the cutoff (will this always look OK?)
And how would I go about implementing the chosen solution?