Netbiscuits XHTML to BBcode conversion
This "Dreamweaver Function Source" converts SDL Tridion XHTML (from a Rich Text Field) into BBcode understood by Netbiscuits.
BBCode or Bulletin Board Code is a lightweight markup language used to format posts in many message boards. Netbiscuits also uses it to format its rich text in their BiscuitML. More on the use of BiscuitML can be found in the article Go Mobile with SDL Tridion 2011 and Netbiscuits.
Through Tridion Modular Templates we can use Custom Functions to add to the Dreamweaver Template �language�, This extension will add the following two Custom Functions:
RenderComponentFieldAsBBCode(fieldname, fieldIndex, outputImages)
Using this extension
The following are examples of how you can use this extension in your Dreamweaver templates:
Convert RTF to BBCode without images
Convert RTF to BBCode with images
@@RenderComponentFieldAsBBcode("body", 0, true)@@
Differences from default DW Behavior
Basically the two methods are called instead of the RenderComponentField() call and will convert your (X)HTML into BBcode, optionally with images (you might want to omit images from a Rich Text Field as BiscuitML will not transform them for the requesting device, so the easiest solution is to just not output them and output them in a image widget.
Installing this extension
To enable this extension you will need to:
- Add the "Templating.Expression.NetbiscuitsFunctions.dll" file to your Content Manager�s GAC (Global Assembly Cache)
- Register it with the Tridion Template Engine by adding it to the file [Tridion]\Config\Tridion.ContentManager.Config
Adding it to the Global Assembly Cache
You can add the assembly to the Assembly Cache by executing:
gacutil.exe /i Templating.Expression.NetbiscuitsFunctions.dll
Registering the Extension with the Tridion Template Engine
Edit the file [Tridion]\Config\Tridion.ContentManager.Config.
Towards the end of this file you will find a section named �function Sources�. Add the highlighted line below to your configuration file:
assembly="Templating.Expression.NetbiscuitsFunctions, Version=126.96.36.199, Culture=neutral, PublicKeyToken=1dc42e7505ed5ba7, processorArchitecture=MSIL"/>
Make sure that this file is still well-formed after you edit it.
You will have to restart the Tridion Content Manager COM+ server, the Tridion Publisher and the Tridion Template Builder before you can use this extension.
This extension is created for version SDL Tridion 2011 SP1.