PostBBCode was written to provide BBCode support for various modules. It's working, but because it's a alpha version and it has been used only one time (in postguestbook) I'm sure there are things that have to be changed to support a wider set of modules.
This version of PostBBCode can be integrated by the use of two functions.
postbbcode_user_html_buttons is used to add buttons and JavaScript to the input form. These buttons make easier for the site visitor to insert BBCode. The JavaScript Code is based on the XForum implementation of BBCode and allows to format selected text (MSIE only) in a textarea. If no Text is selected or browser other than MSIE is used a Prompt to insert text for formation is presented.
The Code for inserting this html snippet is as follows:
Example 4-1. inserting BBCode Buttons
if (pnModAvailable('postbbcode') && pnModAPILoad('postbbcode', 'user')) { $bbcode_html = pnModAPIFunc('postbbcode', 'user', 'html_buttons', array('form_name' => 'pgb_form', 'control_name' => 'pgb_message')); $output->Text($bbcode_html); } |
The function takes to parameters - the name of the form and the name of the textarea control. These parameters define where the bbcode should be inserted.
Note: The current implementation allows only one control. The code resulting from this function call must not be used twice in a html page!
If you don't want buttons the user can always enter the bbcodes by hand.