This article describes the use of placeholders with types 3 to 5 for checkboxes and selection fields in templates.
Possible Types for a Checkbox
| type=3 | Simple Checkbox Yes/No (1/0) |
| type=4 | Checkbox. Depending on the state, the value set via checked= or unchecked= is output. |
| type=5 | Selection (Radio Buttons, single choice). The options are defined via values=; the value of the chosen option is output. |
Checkbox with type=4
A checkbox outputs one of two values depending on its state:
Setting | Description |
checked=x | Value output when the checkbox is checked (default if not specified: 1). |
unchecked=x | Value output when the checkbox is unchecked (default if not specified: empty). |
default=1 | Checkbox is checked by default when creating the advertising material. |
Example — an optional border via a CSS class (define the class
.border in the CSS Code field of the template):<div class="%template{type=4|checked=border|unchecked=|default=1}:Show border%">...</div>Complete HTML elements are also possible as values, e.g. an optional overlay image:
%template{type=4|checked=<img src="overlay.png">|unchecked=}:Show overlay%Make sure the value is self-contained (no open tags like a single
<div ...> without a closing tag)—the placeholder inserts its value at exactly one location.If multiple independent options are needed, simply use multiple
type=4 placeholders—each at the place in the code where its value should be inserted.Selection (Radio) with type=5
The selectable options are set via the
values= setting, separated by semicolons (;):%template{type=5|values=Red;Green;Blue}:Background color%The displayed name is also the value inserted into the HTML code. If display name and inserted value should differ, separate both with a tilde (
~) in the form DisplayName~Value:%template{type=5|values=Red~#ff0000;Green~#00cc00;Blue~#0000ff|default=Green}:Background color%When creating the advertising material, the user sees the selection "Red / Green / Blue"; for example,
#00cc00 is inserted into the code.Using
default=x, you set the display name of the preselected option; if not specified, the first option is preselected. Exactly one option is always chosen.Notes & Restrictions for Types 4 & 5
- Display names and values may not contain the characters
{}|:%;and~(these are part of the placeholder syntax). The character=is allowed, so HTML snippets with attributes (e.g.<img src="logo.png">) work as values. - Because the colon is forbidden, CSS declarations cannot be fully stored as values (
Small~font-size:12pxdoes not work). Write the fixed part in the template and select only the variable part:font-size:%template{type=5|values=Small~12px;Medium~16px;Large~22px|default=Medium}:Font size% - The values within a
type=5field must be unique because the selection is saved based on the value. - If an output value (
checked=,unchecked=, or the value of avalues=option) is changed later in the template, existing advertising materials will continue to output the old value until they are edited and saved once (possibly via Update Template). When editing again, a selection that can no longer be assigned falls back todefault=or the first option. - The setting
required=1is not necessary fortype=4/type=5: Fortype=5an option is always selected, and fortype=4"unchecked" is a valid state.