Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.

display_bbcodes()

Quote

display_bbcodes(width, [textarea_name : string = "message"], [inputform_name : string = "inputform"], [selected :bool = false]) string


[intro]Bulletin Board Code or BBCode is a lightweight markup language used to format posts in many message boards. The available tags are usually indicated by square brackets surrounding a keyword, and they are parsed by the message board system before being translated into a markup language that web browsers understand as XHTML.[/intro]

This function will display all or chosen BBCode buttons for a given text area field so you can easily insert BBCodes into the text you are writing.

This function will return BBCode buttons which you can click on to insert a BBCocde in a given text field.

Usage

Code
<?php
 require_once INCLUDES."bbcode_include.php";
 echo "<form name='inputform'>n";
 echo "<table>n<tr>n";
 
 // Display the Text Area which we will insert BBCodes to
 echo "<td class='tbl'><textarea name='message' cols='60' rows='5' class='textbox' style='width:295px'></textarea></td>n";
 echo "<tr>n</tr>n":
 
 // Display the BBCode Buttons
 echo "<td class='tbl1'>".display_bbcodes("300px", "message", "inputform", "smiley|b|i|u||center|small|url|mail|img|color")."</td>n";
 
 echo "</tr>n</table>n</form>n";
 ?>

Implementation Demo

Demo of the html bbcode buttons rendering.

Parameters

$width
Width of the DIV which holds all the BBCode buttons. This can either be a percentage or a fixed value of pixels but remember the suffix, either % or px.

$textarea_name
The name of the textarea the BBCodes will be inserted to. Default is message.

$inputform_name
Remember that the form where the textarea is located must have a name assigned so that it will be inserted to the right textarea. Default is inputform.

$selected
Leave this blank if you want to display all BBCodes buttons or limit the number of BBCodes buttons by selecting just a few seperating them with a | and no spaces.

Version

Version 7.xx, Version 8.xx