-
Notifications
You must be signed in to change notification settings - Fork 23
How To Enter XML & HTML
Often when posting in a forum, you need to add HTML or XML that you want to render as HTML. Other times you might want to display as code rather than be inherently rendered by the browser.
We've made some recent improvements to how HTML and XML are rendered so that you can use forum posts for either directly rendering HTML vs. displaying HTML/XML for documenting something in a post. Note that instructing the browser to not render the HTML or XML requires the extra step of wrapping your HTML or XML inside <code>
and </code>
tags. We expect to continue improving this process, but in the meantime, here are some examples and tips.
Using the CKEditor UI, style the HTML as you want it to render; in this example, we're using a "Heading 1" paragraph format and setting a color for some text:


After styling, the content displays in the UI editor:

And once the post is submitted, it will display; note that the CSS defined for CKEditor may differ from the CSS styles defined in your forum instance's theme:

If you don't have the style options available in the CKEditor, you need to enter HTML markup directly:

And once the post is submitted, it will display; note that the CSS defined for CKEditor may differ from the CSS styles defined in your forum instance's theme:

When entering in the "Source" mode in CKEditor, directly enter the HTML:

It will render as entered:

Directly enter the HTML:

It will render as entered:

- Enter the desired HTML and select the entire snippet
- Click on the "paragraph format" dropdown
- Select "Computer Code"

When you look behind the scenes, using the "Source" button, you can see that CKEditor wraps the HTML in <code>
tags and encodes the HTML:

When the forum post is displayed, the HTML will display as readable HTML:

When entering in the "Source" mode in CKEditor, enter HTML--but wrap the HTML in <code>
tags:

The HTML will display as readable HTML rather than being rendered:

Directly enter the HTML, but wrap in <code>
tags:

When the forum post is displayed, the HTML will display as readable HTML:

- Click the
code
icon:

- This will insert
[code]
tags:

- Insert your HTML between the
[code]
tags:

The resulting post will display as readable HTML:

- Enter the desired XML and select the entire snippet
- Click on the "paragraph format" dropdown
- Select "Computer Code"

When the forum post is displayed, the XML will display as readable XML:

When entering in "Source" mode in CKEditor, enter HTML--but wrap the XML in <code>
tags:

When the forum post is displayed, the XML will display as readable XML:

Enter the desired XML wrapped in <code>
tags:

When the forum post is displayed, the XML will display as readable XML:

- Click the
code
icon:

- This will insert
[code]
tags:

- Insert your XML between the
[code]
tags:

The resulting post will display as readable XML:

This module is the official forums module for DNN and is used on the official DNN CMS Community website.
- Forums
- Email Notifications
- Polls
- Tags
- Categories
- Attachments
- Avatar injection (new in 9.1)
- Recycle Bin (new in 9.1)
- Badges (new in 9.2)
- User Mentions (new in 9.3)