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 rather just a small section of it, making it suitable for smaller functionality which will be 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.
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.
- Dynamic Content is integrated with the CMS core and the parsing engine is optimized to improve performance.
- Uses hashes to make sure only CMS code can update the contents.
- Fully adapts ASP.NET functionality.
The Dynamic Content concept was introduced in CMS before blocks became available. Blocks and dynamic content are somewhat overlapping concepts and we generally recommend blocks where possible. Since CMS 7.5, it is possible to drag and drop a block into a rich text area which makes it possible to use the block as a "dynamic content" in the text. The main limitation with blocks in rich text is that this is always treated as a block level element. Dynamic content can be treated as either an inline or block element.
Dynamic Content has functionality to auto-generate an editor for the settings for dynamic content. This still uses the editing system that was used in CMS 6; 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. This means that it is not possible to automatically create editors to select a file, for example, an image.
- Also, the editor that is used is an older version of Tiny MCE that might work slightly different than the main Tiny MCE editor. One example is that this is not upgraded to fully support 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 new content types introduced in CMS 7 and above, for example, Content Areas.
These limitations are only valid when you are using the auto-generated user interface. You can always create your own editorial user interface for your dynamic content to overcome most of these limitations.
When you develop dynamic content, consider the following:
- Create a .NET class that implements the
IDynamicContentControl(contains Web Forms specific methods) or
IDynamicContentView(for both MVC and WebForms) interface.
- Register the dynamic content type using either the
DynamicContentPlugInattribute or by registering it in the web.config.
- The editor creates an instance of the dynamic content class, sets its properties and places it as desired in the CMS HTML editor.
- When the page is rendered, CMS replaces the dynamic content design time markup with the actual HTML output of the dynamic content class or its delegated control.
Updated 5 months ago