I have problem with truncation of text. My text includes html tags also.
On main page I display only 100 characters of it, and give read more
link to user. Now if within these 100 characters, if there is any html
tag that is opening and not getting closed within 100 characters, then
that html tag is getting displayed on main page.
How can I solve this problem? Is there any solution for it?
I have problem with truncation of text. My text includes html tags also.
On main page I display only 100 characters of it, and give read more
link to user. Now if within these 100 characters, if there is any html
tag that is opening and not getting closed within 100 characters, then
that html tag is getting displayed on main page.
How can I solve this problem? Is there any solution for it?
I'm following this topic merely because I'm interested in the outcome.
I looked up strip_tags in the API and it seems that it 'removes' the
tags. I don't believe that's what Sunny wants. Truncate take a number
of characters and appends a ... removing the remaining characters that
may have been there. If the end tag of a </b> is truncated away, then
all the text from that point on will be bolded. How is this resolved?