implemet bb code

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

Post Reply
thebay
Forum Newbie
Posts: 1
Joined: Thu Jun 05, 2003 6:27 pm

implemet bb code

Post by thebay »

Can anyone give me an example how to use phpbb.

Actually just like this forum's stile...

I want implement somthing for text input.

In order the customer can input html tags, such as bold, italic easily, I want to show a tool bar on top of the text area, then users just input the sentence, if they want "bold" certain word, just highlight it, then click the icon of "bold", then the sentence will be added <bold> the word</bold> automatically..

Anyone has an idea how I implement such function
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

ereg_replace()

Search for any tag you create, such as [bold] and [/bold]. Then replace it with the HTML tag for that specific code, in this case <b> and </b>.

That how I did it for a forum system i created. It works great for smilies too. Search for the text combo :) and then display <img src="images/smile.jpg">, for example.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Since phpBB is opensource you can always download their code and see how they did things:
http://www.phpbb.com

Mac
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

and there are many more free implementations of BBCode, e.g. check http://www.hotscripts.com
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

And if you still need more info, have a look at this thread http://www.devnetwork.net/forums/viewtopic.php?t=9396
Post Reply