View Full Version : bbcode/vb code: How to implement?
Greetings friends,
I've been creating simple applications/dynamic pages that receive text content via a database. The database is updated via forms.
So far, text has had to be formatted using standard html tags.
Unfortunately, many of my users don't want to use html tags...and would rather select their text, then click a button (for bold, for example) a la a word processor.
I know there's a way to implement a "bbcode/vbcode"-style editor within the form...but can find no resources to give me any tips/snippets.
Anyone have any suggestions?
I'd certainly appreciate your help!
Sincerely,
Michael
You use preg_replace or str_replace to swap out [ b ] with <b>.
In order to highlight and click buttons, you have to use javascript.
Hi, Pig,
Thanks for the input.
I suppose I'm looking for some pretty specific resources here. A general conceptual overview isn't really that helpful.
I already have the initial JavaScript bbcode snippet (subblue) to make the buttons, etc. (although I can't get it to work).
I also understand the underpinnings of bbcode --> html conversion.
I'm specifically looking for tutorials/tips/additional snippets to make a functional formatter for form-based text.
vBulletin (used by PowWeb) has one built-in. So does phpBB.
I'm sure that somewhere the code and implementation of this code is available to the open-source community.
I'm not sure where, however.
Anyone have any clues?
Much obliged,
Michael
Originally posted by mwilder
I'm sure that somewhere the code and implementation of this code is available to the open-source community.
Yes, it's available in the source code files that you get when you download an application like phpbb.
If, instead, you are looking for a specific step-by-step tutorial on how this functionality is incorporated into the architecture of a BB application, and you find one, please post it here. It would make interesting reading!
Thanks.
:)
snowmaker
11-4-03, 03:51 PM
Originally posted by mwilder
...and would rather select their text, then click a button (for bold, for example) a la a word processor.
this might be a solution for you, http://snippetmaster.com. i'm not sure how to work it with a form, but i'm sure it could be done. there's a demo, faq, and screen shots on the site.
cheers, -b
Indeed!
Thanks for responding, Nino.
Although I've found a number of apps that perform a similar function to what I'm looking for (wysiwyg form-based text editor), most are platform/browser specific (IE 5.5+, Win only).
So far my only success has been in snarfing the editor in phpBB and customizing to my needs. It's far from perfect, but I'm making progress.
My conclusion is as Pig suggests: the editor must be made in JavaScript with buttons that insert html tags and developed to accomodate all browsers.
Connecting the final text box itself to feed a database can be accomplished with standard PHP/MySQL strategies.
I don't relish the idea of reinventing that wheel, however.
Again, if anyone has any leads, I'd be glad to share my findings.
Hi, Snowmaker,
Although I sincerely appreciate the suggestion, Snippetmaster doesn't really address what I'm looking for.
Thanks much, however! :-)
Michael
vBulletin v3.6.0, Copyright ©2000-2010, Jelsoft Enterprises Ltd.