PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
grgwhl
Forum Newbie
Posts: 3 Joined: Mon Dec 29, 2008 12:00 pm
Post
by grgwhl » Mon Dec 29, 2008 4:46 pm
Code: Select all
function topic($input){
//bbcode
return nl2br(strip_tags(stripslashes(htmlspecialchars($input))));
}
there is my function where my bbcode code should go, but i wouldn't know how to do it.
Andrewrun
Forum Newbie
Posts: 7 Joined: Fri Dec 26, 2008 12:46 pm
Post
by Andrewrun » Tue Dec 30, 2008 1:49 am
Check out phpbb. It's open source, so you can plug through that.
Basically, you're going to want to do a whole slew of preg_replace's for each of the possible bbcodes that you're going to allow.
For example, to replace you could do something like:
preg_replace('%\[color=(.*)\]%',\1);