Using BBCode in forum posts
Bulletin Board code (BBCode) is a lightweight markup language designed to let users format text of their messages. It is used in many forums on the web, not just on websites created with Kentico. Its tags are similar to HTML tags and are entered in square brackets.
Users can use BBCode in their forum posts only if it is enabled. You have to allow use of BBCode when editing a forum or forum group, on the General tab of its editing interface in the Forums application.
URLs in BBCode
All URLs in macros (URL, IMG) are validated as a URL to avoid XSS and resolved into their absolute URL equivalents. The following URL formats can be used:
- www.google.com – URL starting with www.
- http://devnet.kentico.com – URL starting with protocol
- ~/CMSDesk/default.aspx – Virtual path
- ../default.aspx – Relative URLs
- /Kentico/default.aspx – Server relative URL
API for BBcode
You can resolve BBCode in ASPX or codebehind code. To resolve all BBcode macros in a string, use the following method:
string CMS.Helpers.DiscussionMacroHelper.ResolveDiscussionMacros(string inputText)
Or you can use the CMS.Helpers.DiscussionMacroHelper
class to resolve macros with particular settings using the ResolveMacros
method.