DPE Web Applications 2.x

Template Includes

Creating a reusable Template Include snippet 

First find or create the ContentManager | Details | TemplateIncludes folder, where you can create or edit the key for your Template Include snippet. 

Including snippets in templates

Snippets are included in templates by referencing the Key created under ContentManager | Details | TemplateIncludes | <Key>, using the include helper like this: {{!# include <Key>}}

Example snippet for displaying the Title

XML
<!-- include DefaultTitle -->
{{#if editable}}
  <div data-col="sm-4 xs-12 valign-sm-center valign-xs-bottom">
    {{label-helper value=editModel.Title label="Title:"}}
  </div>
  <div data-col="sm-8 xs-12 valign-center" class="editable-field">
    {{input value=editModel.Title placeholder=editModel.TitlePlaceholder type="text"}}
  </div>
{{else}}
  <div class="details-area-text-bold" data-col="sm-4 xs-12 valign-sm-center valign-xs-bottom">
    Titel:
  </div>
  <div data-col="sm-8 xs-12 valign-center">
    {{model.Title}}
  </div>
{{/if}}
<!-- // include DefaultTitle -->

Example including snippets templates

XML
{{#form-container legacyController=legacyController}}
  {{#responsive-grid-area tabindex="0"}}
    {{!# include DefaultTitle}}
    
    {{#if editable}}
      	<div data-col="sm-4 xs-12 valign-sm-center valign-xs-bottom">
			{{label-helper value=editModel.Author label="Author:"}}
		</div>
      	<div data-col="sm-8 xs-12 valign-center" class="editable-field">
			{{combo-box model=editModel field="Author" source=legacyController.definitionSource canCreate=true}}
		</div>
...