Skip to main content
Skip table of contents

Template Conditional Helpers

Conditional helpers allow users to specify conditions for rendering part/section of a template. These helpers add additional truth logic to if and unless statements.

equal

Check if something is equal to

CODE
{{#if (equal model.Class "Audio")}}
	 <!--displayed when class is audio -->
{{/if}}

not-equal

Check if something is not-equal to

CODE
{{#if (not-equal model.Class "Audio")}}
	 <!--displayed when class is anything but audio -->
{{/if}}

not

Checks if something is not true or does not exist.

CODE
{{#if (not model.Invalid)}}
	<!--displayed when entry is not invalid-->
{{/if}}

and

Similar to if (a && b), returns true when both a, b are true.

CODE
{{#if (and model.Author model.Editor)}}
	<!--displayed when entry has both Author and Editor-->
{{/if}}

or

Similar to if (a || b), return true when either of a,b holds true

CODE
{{#if (or model.Author model.Editor)}}
	<!--displayed when entry has either Author, Editor or both present-->
{{/if}}

xor

if (a && !b || !a && b)

CODE
{{#if (xor model.Author model.Editor)}}
	<!--displayed when entry has either Author, Editor but not both-->
{{/if}}

gt

greater than

CODE
{{#if (gt model.Id 1000)}}
	<!--displayed when entry Id is greater than 1000-->
{{/if}}

gte

greater than equal to

CODE
{{#if (gte model.Id 1000)}}
	<!--displayed when entry Id is greater than and equal to 1000-->
{{/if}}

lt

less than

CODE
{{#if (lt model.Id 1000)}}
	<!--displayed when entry Id is less than 1000-->
{{/if}}

lte

less than equal to

CODE
{{#if (lte model.Id 1000)}}
	<!--displayed when entry Id is less than equal to 1000-->
{{/if}}

is-array

is of Array type

CODE
{{#if (is-array a)}}
	<!--displayed when a is of type array-->
{{/if}}

is-empty

is an Array or object is empty

CODE
{{#if (is-empty model.MemberIds)}}
	<!--displayed when entry has no members-->
{{/if}}

is-equal

compares if two objects are equal

CODE
{{#if (is-equal a b)}}
	<!--displayed when object a and b are equal-->
{{/if}}

includes

Checks if a string contains (as sub-string) a specific value.

CODE
{{#if (includes model.Title "Test")}}
	<!--displayed when entry title contains Test -->
{{/if}}

ends-with

Checks if a string ends with a specific value

CODE
{{#if (ends-with legacyController.contentManagerContextMenu.DPEVersion "1.200")}}
	<!--displayed when current DPE version ends with 1.200 -->
{{/if}}

starts-with

Checks if a string starts with a specific value.

CODE
{{#if (starts-with legacyController.contentManagerContextMenu.DPEVersion "1.14")}}
	<!--displayed when Current DPE version starts with 1.14 -->
{{/if}}

version-between

Checks if a version string (like legacyController.contentManagerContextMenu.DPEVersion) is between two provided versions.

CODE
{{#if (version-between legacyController.contentManagerContextMenu.DPEVersion "0.0.0.0" "1.14.123.0")}}
	<!-- displayed when Current DPE version is less or equal than 1.14.123.0 -->
{{/if}}
{{#if (version-between legacyController.contentManagerContextMenu.DPEVersion "1.14.123.0" "99.0.0.0")}}
	<!-- displayed when Current DPE version is bigger or equal than 1.14.123.0 -->
{{/if}}
{{#if (version-between legacyController.contentManagerContextMenu.DPEVersion "1.14.123.0" "2.2.18.0")}}
	<!-- displayed when Current DPE version is 1.14.123.0 or newer, but not newer than 2.2.18.0 -->
{{/if}}

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.