Finally, we come to the last of the definitions – Template Definitions.
Template Definitions combine everything that we have set up in CL: you create sections by choosing a layout and the components to arrange in that layout, you can optionally choose a nav wrapper and then configure whether you include some built-in features.
Template Definitions are used to generate a standard DXM template with three event handlers being created for you: input.aspx, post_input.aspx and output.aspx. These event handlers are re-created every time the template definition is saved so you shouldn’t make any modifications to them after generation.
However, you are free to add any other template handlers you need. Commonly this will be the filename, url and the three search g2 handlers: search_g2_insert, search_g2_update and search_g2_delete.
Template Definitions can be created in the Template Definitions folder using the File > New > Template model.
Once created, you should see the template definition data entry form.
On the ‘Components’ tab, you can sections. Each section is composed of a layout plus a list of components and how they should be allocated to the slots in the chosen layout.
As with Nav Wrapper Definitions, you can target multiple components to a layout slot, in which case CL will render the components in sequence.
On the wrapper tab, you can choose whether to use a nav wrapper or not. If you are using one, you will have two choices of how you specify this:
Custom Wrapper: this option requires that you point to a DXM template that has the output code of the nav wrapper; or
Nav Wrapper Definition: this option requires that you point to a definition asset.
On the settings tab, you can specify:
the name of the generated DXM template — defaults to the same name as the template definition;
the folder you want to template generated into – defaults to the project/templates folder
whether to include any built-in features such as:
page metadata: only useful if the template you’re creating represents a whole HTML page rather than just a fragment of content;
TMF (translation model framework).
You can also select “Enable Advanced Capabilities” on this tab. Doing this will add another tab to your content form input experience that has a clickable link back to the template definition. This is useful at development time so that you can quickly go back to the definition, change some options and have the template regenerated.
Crucially though, you must check the “Create: yes” option before CL will generate anything.