PDA

Click to See Complete Forum and Search --> : [RESOLVED] Parsing BB code


Kasracer
Jun 20th, 2006, 10:14 PM
I'd like to include some BB like tags for my website. It's not difficult to implement some like ] and [i] because you can just use str_replace with a span with the correct style and just check for even numbers of starting and ending so it doesn't mess up the page.

What I'm not sure about is including a url or img tag. The img tag shouldn't be difficult but I heard there were security vulnerabilities with vBull's img tag and I want to make sure I don't make the same mistake. I also don't understand how to parse the url tag as it could be url www.vbforums.com /url or url=www.vbforums.com VBForums[/url] Again, I want to make sure I'm not opening myself up to attacks.

Is there any funcitons built into PHP geared towards this or any functionality like this already written and proven that would allow me to use it in my website?

EDIT: Unfortunately I couldn't put in the proper BB codes but you should get the idea

penagate
Jun 20th, 2006, 11:18 PM
I do,

I have a BB code parser here, it's could be better but it does the job.
http://dev.penagate.spiralmindsinc.com/php/bbparser/bbcode.phps

the [img] tags might be a little weird. I'm not sure which version of the code that is :blush:

If you want me to pick apart any of that for you I'll do so.

Kasracer
Jun 21st, 2006, 12:12 AM
Thanks! I'm never good with regex but I should be able to work from that :)