The problem is simple:
Using tinyMCE, I am storing html data into the database. Then at the home page, I am showing 5 latest posts I've inserted into the database. I want to crop each of these posts to the specified length if they exceed it and put a continue reading
link (can be a soft crop here, doesn't have to be rigid).
It would be easy to crop the string with php's wordwrap
function but since the string is composed of html I don't wanna ruin the html code by cropping it from a wrong place.
So the question is: Is there an easy way to crop this, (can be a css, javascript solution as well) or do I have a write a long function with lots of checks to implement such a basic feature? I was thinking to use the DOM
class but before creating function I just wanted to ask you guys.
EDIT
Styling is essential to me. So there is no possibility to strip the tags.
Thanks in advance.