I created a mini "blog feed" for the front page of my clients website. I want to be able to truncate each of the posts and add a "read more" link the end. Easy enough job, accept each blog post may or may not contain 'IMG' (auto resized) and 'EMBED' (youtube vids) tags and I want to ensure the string is NOT broken on those tags or it will display an empty link.
So my question is, what would be the best way to tackle the problem?
Kind regards and thanks,
strip_tags is what you're looking for I think, This page should help....
That would remove ALL HTML from the preview.
There is a little bit of regular expression further down the page. Look in to that too. Powerful stuff
You'll need that if you want to show some HTML but only whole tags.
hey! funny enough I went with strip_tags in the end. Then I opted to prepend a video or image onto the string with the title "attached media! - seems to work nice
Nice, and probably the fastest method processor-wise too
Yeah its a neat solution, I really should have thought of it sooner however
This topic is now closed. New replies are no longer allowed.