

|
|
DP_ParseBBML CFML Custom TagDownload | Revision History | Usage | Example Output | Resources This ColdFusion 4.5+ CFML custom tag translates a simplified, HTML-like markup language called "BBML" (supported BBML tags) into valid HTML. BBML is based on the original UBBCode™ used in the very popular Ultimate Bulletin Board™ discussion application. Useful for online forums or content editing applications this gives end users some of the power of HTML without risking "damage" to the rest of the presentation. The tag has the following features:
Thanks to Craig from Cyber Creations Inc. for testing, support and suggestions, Dain Anderson from cfcomet.com for the use of CF_ColoredCode, Andy Jarrett of The Blue Frog Company for his contribution of alternate smilies, and Jochem van Dieten for his implementation of the [sql][/sql] tag.
|
| Input | The input string to convert. Optional if an end tag exists. |
| OutputVar | A valid ColdFusion variable name. Defaults to "DP_ParseBBML". The name to be used for the results structure. |
| ConvertSmilies | Boolean (Defaults to "No"). If "Yes/True" will convert supported smilies to HTML <img> tags. If "Yes" requires the "SmileyPath" attribute to be set. |
| SmileyPath | A path to the directory where the smiley graphic set is relative to the template(s) calling the tag. Required if "ConvertSmilies" is set to "Yes". Examples are "/Art/Smilies/" and "../../Smilies". |
| ConvertHTML | Boolean (Defaults to "Yes"). If "Yes/True" will convert HTML tags in the input string to character entities. For example "<br>" will be converted to "<br>". |
| ConvertBBML | Boolean (Defaults to "Yes"). If "Yes/True" will convert all valid BBML code in the input string to HTML. |
| RevertToBBML | Boolean (Defaults to "No"). If "Yes/True" will attempt to convert all HTML code to BBML and will also ignore the values of "ConvertBBML", "ConvertSmilies", and "ConvertHTML". There is no validation of this process. This feature was specifically added to revert BBML content previously converted to HTML with this tag. Using it on arbitrary HTML content is not recommended. |
| UseCF_ColoredCode | Boolean (Defaults to "No"). If "Yes/True" will attempt to color code all material within [code][/code] BBML blocks. This is a complex process and a performance hit should be expected. |
The basic output of the tag is a structure named "DP_ParseBBML" (this name can be changed via the "OutputVar" attribute) containing the following keys:
| Input | String. The original input string, before conversion. |
| InputLen | Integer. The length of the original input string. |
| Output | String. The converted string. |
| OutputLen | Integer. The length of the converted output string. |
| ConvertSmilies | "Yes" or "No". Same as the disposition of the "ConvertSmilies" attribute. |
| ConvertHTML | "Yes" or "No". Same as the disposition of the "ConvertHTML" attribute. |
| ConvertBBML | "Yes" or "No". Same as the disposition of the "ConvertBBML" attribute. |
| RevertToBBML | "Yes" or "No". Same as the disposition of the "RevertToBBML" attribute. |
If the tag has an end tag and the "Input" attribute has not been defined then the tag will convert anything contained in the tag and automatically output to the page. The DP_ParseBBML structure detailed above is still available.
The following examples show several methods of calling DP_ParseBBML.
<cfmodule template="DP_ParseBBML.cfm"
ConvertSmilies="Yes"
SmileyPath="\Smilies\">
Tag Input (BBML Code, HTML code, Smiley Code, etc)
</cfmodule>
<cf_DP_ParseBBML Input="#Form.Text#"
ConvertSmilies="Yes"
SmileyPath="\Smilies\">
</cf_DP_ParseBBML>
<cfoutput>#DP_ParseBBML.Output#</cfoutput>
<cf_DP_ParseBBMLmodule Input="#Form.Text#"
OutputVar="Conversion">
<cfoutput>#Conversion.Output#</cfoutput>
Example Tag Output
back to top
The following BBML code:
[list] [*][i]Italic Item[/i] [*][link=http://www.depressedpress.com]Linked Item[/link] [*]Item Three [/list]
converts to the following HTML:
<p><ul><li><i>Italic Item</i></li><li><a href="http://www.depressedpress.com">Linked Item</a></li><li>Item Three</li></ul></p>All supported BBML is detailed in this document.
Other Resources
back to top
Other resources to help you make the most of this component including code walkthroughs and supporting systems and external web links.