OpenWGA 7.5 - WebTML reference


Dynamic WebTML attributes

The contents of all WebTML attributes may be dynamically calculated, i.e. the contents of the attribute is determined in the moment that the tag is rendered by some kind of function.  Mostly this function is a simple TMLScript expression:

For example:

<tml:item name="{ isDefined('partNr') ? 'partNr' : 'orderNr' }"/>

This <tml:item> tag dynamically determines which item it should display. If there is an item "partNr" defined it returns the string "partNr" to appear in attribute "name", so this item is displayed. Otherwise it returns the string "orderNr", which is the name of an item that should be displayed for all documents not having a "partNr".

There are some syntaxes available for dynamic attributes that use different functionalities for calculating the attribute contents:

attribute="{TMLScript expression}"

A TMLScript expression, processed in the document context of the WebTML tag, whose result will be the contents of the attribute. If the result is a List it is joined to a single string with commas as separators.

A special value "VOID" is available to these TMLScript expressions. Returning it as the result of an attribute expression will let WebTML behave like the attribute does not exist. For example:

<tml:foreach sortorder="{ isDefined('mysort') ? mysort : VOID }">

This will let the attribute "sortorder" be effective only if an item/variable "mysort" exists. If it is not the "sortorder" attribute is ignored and the foreach output is not sorted.

attribute="[String {TMLScript expression} String]"

An attribute composed from static strings (parts directly inside square brackets) and parts calculated by TMLScript expressions (parts inside curly brackets) that are processed just like using the syntax above. Parts are joined to a single string without any separators. The attribute may contain as many dynamic parts, marked by curly brackets, as needed.

attribute="{item:itemname}"

Returns the value of the given item from the context document

attribute="{meta:metatype/metaname}"
attribute="{meta:metaname}"

Returns the value of the given metadata field of the given type. Omit the type to return a metadata field of type "content". 

attribute="{tag:Tag-ID}"

Returns the output of the WebTML tag of the given ID

attribute="{plugin:pluginname}"

Returns the database key of the plugin of the given unique name or plugin shortcut

attribute="{option:optionname}"

Returns the value of the given WebTML option

attribute="{label:labelkey}"

Returns a WebTML label of the given key in a language accepted by the user

attribute="{scoped:text}"

Creates a scoped version of the given text. See WebTML scoping.