Say I have a 200 character string that contains HTML markup. I want to show a preview of just the first 50 chars. without ‘splitting up’ the tags. In other words, the fragment should not contain a <b> without a </b>. Any server side processing should be in PHP.
Say I have a 200 character string that contains HTML markup. I want to
Share
You should check out Tidy HTML. Just cut it after the first 50 non-HTML characters, then run it through Tidy to fix the HTML.