Template Fragments
In the Template fragments
folder you can add and edit template fragments for use in the template editor of interaction nodes. The template fragments editor is similar to the main template editor used in regular interaction nodes. To learn more about this template editor, go to the corresponding section.
One major difference between Template Fragments and the regular Templates for Interaction Nodes, is the use of buttons.
In Template Fragments, buttons cannot be used as "Follow button exit
", because Exits are linked to specific Interaction Nodes on the Flowchart Canvas, and only the main Template which is the Template Property of that Interaction Node, has access to the available exits and can use these exits in buttons on the page. Template Fragments can be part of many Templates and even other Fragments, so they can be linked to many nodes that each have their own specific exits.
In Template Fragments, you will typically use buttons that Refresh the page, Execute Flowcharts, Navigate to navigation items, Link to external addresses or a File in the Files library.
Templates Fragments are generally used for following reasons:
Re-usable Content: if certain page elements are used multiple times in the same or even in different interaction nodes, these elements can be added to a Template Fragment for easy re-use in different Templates (or other Fragments). Define once, use many times.
Keep large Interaction Page clean and well-organized: with a lot of elements on one page, that page can become cluttered in the Template Editor and not easy to understand, maintain or make changes at later stages. Using Template Fragments to hold certain coherent blocks of content can help to make the Page nice and tight, easy to oversee and make changes.
Help debug and find issues: if a large page is causing issues or fails to render at runtime, you can use Template Fragments to isolate (coherent) parts of the page and one-by-one add them to the page, or use conditionals to turn them on or off, until you find the specific element that is causing the issue.
When you want to use the template in an interaction node, the template can be dragged and dropped from the resource pane onto the template editor. Or, you can use the Nested Template icon from the Editor Toolbar - this will open an overlay where you can select from the available collection of Tempalte Fragments.
A Fragment that is added to the template canvas will not be rendered with all its specific contents, but as a compact element like shown in the image below. If you want to open the template fragment, you can click the [-> icon in the right-corner of the Fragment Element, this opens the fragment in another window so you can edit its contents.
Any Template Fragment can be as small as just one element (or none), or contain many combined elements, even other Fragments. You can NOT nest a Template Fragment in itself (the Modeler Template Editor checks and blocks this situation).
It can be a very strong and useful feature in the management and creation of your pages.
Last updated