PDA

View Full Version : BBcode - PHP



imagined
March 10th, 2004, 01:16 PM
I have been doing searches on BBcode. I get the definition and some examples, like [-b] make this bold [-/b]

I didn't even know BBcode existed and am eager to learn more about it. Like it says in a previous post, I want to give the users the option to bold, italize, underline, change font style, font size, font color and to parse URLs.

But how can I achieve this with BBcode? Isn't the same:

<b> bold this </b>

as

[-b] bold this [-/b]

How can I add buttons to format whatever is highlighted? If I can do this with BBcode, how? :puzzle:


PD
I'm doing this for a Content Management System, not a Forum.
Sorry. I added the dash so the text wouldn't get bolded and you could see the tag.

Jubba
March 10th, 2004, 01:50 PM
well its not that hard really. But its also not that easy. Basically when you do something like that you would have the input textbox and someone would place the tags. Say their message was like this:

My name is bobby!

Then when they submit the form the php script reads the string, searches for and an accompaning then replaces them with a <b> and </b>

Then if you plan on having buttons above the textbox to add things like bold, italics, underline, etc.. then that is javascript that want for that...

BBcode itself is not a language or anything like that. It is just an easy way for people to not have to know HTML when you are making things like CMS or forums.