Sub Templates: Difference between revisions

1,786 bytes added ,  06:42, 11 September 2022
no edit summary
No edit summary
No edit summary
Line 1: Line 1:
You can create templates that are marked as "Sub Templates" in order to use their content in other templates. This feature is especially useful when a common markup is needed on multiple templates (such as signature, header).
{{DISPLAYTITLE:Sub-Templates}}


== Creating Sub Templates ==
You can create templates that are marked as "sub-templates" in order to use their content in other templates. This feature is especially useful when a common markup is needed on multiple templates (such as signature, header).
A template must be marked as "Sub Template" in order to be available for insertion in other templates. This can be done either at the time of creating a new template, or after - just look for a toggle or checkbox that marks the template as a sub template.


== Using Sub Templates ==
== Creating Sub-templates ==
To add a sub template to an existing/new template, locate the "Insert Sub Templates" option within the template editor. Depending on the version you  
A template must be marked as "sub-template" in order to be available for insertion in other templates. This can be done either at the time of creating a new template, or after - just look for a toggle or checkbox that marks the template as a sub-template.
 
== Using Sub-templates ==
[[File:Sub Template Selector.png|thumb|Add sub-template drop down ]]
To add a sub-template to an existing/new template, locate the "Insert sub-templates" option within the template editor. Depending on the version you have installed in your org, this option may be located in the WYSIWYG editor or somewhere else.
When you select to insert a template, you will only see templates that are marked available to be used as sub-templates. In addition, you will see the date & time of the last edit & the core object the template is based on.
[[File:Template Embedded.png|thumb|Inserted selected sub-template within a new template document]]
Once you select a sub-template that you want to insert, the template will be added at the location of your cursor or at the beginning of the body of the template that you are editing. 
 
== Static Sub-Templates ==
By default, when a sub-template is added, it will be added in a "static" mode. This means that we will add the content of the selected sub-template directly to the body of the template. This allows you to make changes to the content added from the sub-template without affecting the selected sub-template.
 
[[File:Dynamic Template.png|thumb|Inserted dynamic template]]
 
== Dynamic Sub-Templates ==
You can change a template from a "static" to a "dynamic". In doing so, you will no longer be able to edit the contents of the sub-template, nor are you going to be able to view the full content of the underlying sub-template. However, if the embedded sub-template is updated/changed, the updates will reflect immediately to all the other templates that embed that sub-template. 
== Other Important Stuff ==
We cannot version control dynamic templates currently, meaning that every time a document is loaded with an embedded dynamic sub-template, the sub-template will be rendered with the latest version's contents. This is intentional behaviour.
[[Category:3B Docs Features]]
[[Category:3B Docs Features]]