TMLScript-Objekt

TMLContext "this"

Beschreibung The TML context is the base object of the TMLScript runtime and offers various frequently used functionalities. It represents the TML context that is also used by WebTML tags and that always has a special content document in access. The known functionalities of tags <tml:item> and <tml:metadata> to read items and metadata are found here in form of methods like "this.item" and "this.meta".

The method "this.context()" can be used to access different TML contextes and uses therefor the context expressions already known by WebTML attribute "context".

The method "this.content()" allows access to the WGAPI object of the content document currently in context.

Since WGA 3.2 the usage of "this" is implicit. Fields and methods that are not explicitly qualified by an object or declared as Javascript-Variable will be interpretet as fields and methods of "this".
Ermittelbar über Das "this"-Objekt in Webseiten-Scripts
Beispiele Reading an item, in normal and short form:

return this.item("body");
return this.body


Reading a metadata field, in this example the database key of the database in context:

return this.meta("db", "dbkey");


Fetching a different TML context object. The object fetched is again a TML context object offering the same functions but having a different content document in context:

var rootContext = this.context("root");


Since WGA 3.2 the "this" object is implicit and needs not to be specified. The given examples could be written like this:

return item("body");
return body;
return meta("db", "dbkey");
var rootContext = context("root");