Log in

View Full Version : How to close all bbcode tags


waza
01-06-2006, 06:24 PM
Hey,
I want to show only a peace of a post on a page.
So I cut the string to x chars, but I'm afraid If I'm going to parse it, and there are tags, where to closing part has been cut off, they'll mess up my layout.

So, is there a function in vb that closes all open bb tags that have not yet been closed?

grz,
seba

vietkieu_cz
01-06-2006, 06:30 PM
vBulletin Options/vBulletin Options/BB Code Settings/Enabled Built-in BB Codes -> Yes/No :D Maybe it is

waza
01-06-2006, 06:44 PM
Euh, it's not that what I'm looking for, but thx

calorie
01-06-2006, 07:01 PM
Perhaps check out how thread preview is done in the process_thread_array function. Otherwise, you'll probably need to write a regexp to right trim off broken tags. Trying to close a random number of random tags, while accounting for any that get cut, isn't an easy problem, but you probably already know that. ;)

waza
01-07-2006, 07:40 AM
nah, that function doesn't do that, (at least, with a first look at it).
I think I'm just going to strip the bbcode out of it and then cut it off.
Thx

calorie
01-07-2006, 07:49 AM
Right, the process_thread_array function doesn't close tags, but it's an alternative approach. Done regexp to right trim off broken tags, easier than trying to close a random number of random tags, broken and all, but the thread preview approach might, might not, get you closer to what you want. :)