Chapter 1.9. Templates

Docmenta supports two types of templates: static and dynamic templates. The table below gives a short summary:
Static
templates
A static template is a content-node that is located in the folder with alias name "system_templates". The content-editor provides the "Insert predefined content template" button that allows the selection of a node within this folder. The content of the selected template is then copied to the current cursor position.
As an example, consider the situation that you have to create a table with the same header row several times. In this case you can simplify your work by creating the table only once as a static template. Then, at each position where such a table is needed, use the "Insert predefined content template" operation of the content-editor to insert a copy of the table-template.
After the template has been inserted, a user can edit the inserted content as any other content. There is no more connection between the original template and the copy of the template that was inserted.
Dynamic
templates
A dynamic template is content that is connected to a style. When a publication is exported, the template is inserted on the fly at each position where this style is used. Actually, authors who create the content do not have to care about dynamic templates. They are just creating content and assigning styles to the content. The template-insertion is automatically done by Docmenta.
As an example, consider the situation, that you want to mark special paragraphs as warnings, e.g. in the rendered output these paragraphs shall be highlighted with an exclamation icon. However, you might need differnt designs for different output formats. Furthermore, if the design of warnings has to be changed in the future, you want to avoid having to update the content at each position where a warning was inserted. In Docmenta these problems can be partially solved by using style-variants, i.e. defining different CSS properties for the same style ID (see Section 1.3.5, “User-defined styles”). Though, using style-variants is sufficient in many cases, you cannot change the overall layout of a block, just by changing the CSS properties of a style. For example, you cannot turn a simple box to become a table with two rows. However, by assigning a dynamic template to a style, such transformations can be done.
Dynamic templates is the solution of choice to create so called admonitions, i.e. special layouts for notes, cautions, warnings, tips and so on. 
An introduction of both template mechanisms is given in the following sub-chapters.