Parsing BBCode and substr()
I've got an issue I'm unsure how to tackle. I have this system where announcements are made on the forums, and this announcements are also displayed on the homepage. I want to display the topics like a blog, so one after another, but I want to cut them to a certain length with a "read more".
This issue is that these topic posts are full of bbcode, so the issue is how do I cut them to a certain length without breaking html tags?
I can cut the post and then parse bbcode, and vice versa, but the posts are saved to the database with
<br />tags. So that means I'm at a risk of cutting one in half and this REALLY messes with the html. At least in firefox.
Any ideas as to how to go about safely cutting a post with bbcode?
Thanks in advance,