If you want a component which has dynamic content, you can do as the following:
<div data-type="component-x" data-attribute-one="1" data-attribute-two="2" ...>
<h3>Bill details:</h1>
<div data-dynamic-href="/path/to/dynamic/content"></div>
</div>Details:
- Element with
data-dynamic-hrefwill load content from/path/to/dynamic/contenturl with params are alldata-*attributes. In above example, the final url for loading content is/path/to/dynamic/content?data-attribute-one=1&data-attribute-two=2 - All
data-*attributes must be placed in component element
There are 2 ways to render dynamic content in VIEW MODE (not in KEditor aka EDIT MODE):
- Server-side: You can add code in your server-side for detecting dynamic component with
data-dynamic-hrefattribute and generate content for it - Client-side: KEditor provides a static method to load dynamic content is
KEditor.loadDynamicElement(). Please read at here for more details of this method