HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Dynamic content

Describes how to create functionality in code which an editor can use in the HTML editor.

πŸ“˜

Note

Dynamic content is deprecated in Optimizely Content Management System (CMS 12). Use blocks instead. While existing solutions will continue to work, you should not build new solutions on this API. It will be phased out in the future.

A Dynamic Content class does not define a whole page but rather just a small section of it, making it suitable for smaller functionality, which are inserted inline into texts on the site by the editor. A user control (such as a .NET UserControl) implements the user interface part of a dynamic content object.

Recommended use

Dynamic Content has the following advantages:

  • Lets the developer render the contents with any .NET-derived type of control directly into texts written by an editor.
  • CMS core integrates dynamic content and optimizes the parsing engine to improve performance.
  • Uses hashes to make sure only CMS code can update the contents.
  • Fully adapts ASP.NET functionality.

CMS introduced the dynamic content concept before blocks became available. Blocks and dynamic content overlap concepts; you should use blocks where possible. Since CMS 7.5, you can drag and drop a block into a rich text area, which lets you use the block as "dynamic content" in the text.Β You can treat dynamic content as an inline or block element; you can treat blocks in rich text as a block-level element only.

πŸ“˜

Note

Dynamic content can auto-generate an editor for the dynamic content settings. This system has some limitations that you should be aware of if you want to use the automatic editing functionality:

  • The media system introduced in CMS 7.5 is not supported, which means you cannot automatically create editors to select a file, for example, an image.
  • Also, the editor used is an older version of TinyMCE that might work differently than the main TinyMCE editor, such as not supporting Internet Explorer 11. Another drawback is that you cannot link to a file in the media system inside the HTML editor.
  • There is no support for content types introduced in CMS 7 and above, such as content areas.

These limitations are only valid when you are using the auto-generated user interface. You can create your editorial user interface for your dynamic content to overcome most of these limitations.

Develop dynamic content

When you develop dynamic content, consider the following:

  • Create a .NET class that implements the IDynamicContentControl (contains Web Forms specific methods) or IDynamicContentView (for MVC and WebForms) interface.
  • Register the dynamic content type using the DynamicContentPlugIn attribute or by registering it in the web.config.
  • The editor creates an instance of the dynamic content class, sets its properties, and places it in the CMS HTML editor as desired.
  • When you render the page, CMS replaces the dynamic content design time markup with the actual HTML output of the dynamic content class or its delegated control.