This object represents the configuration of a specific WebTML portlet for the current browser user. It mainly consists of a number of items that may influence behavior and appearance of the portlet. Those items can be set via portlet.setitem() and read via portlet.item() or in WebTML via <tml:item type="portlet"/>. Like on content and profile documents modified items must be saved via portlet.save() so they get stored.
There is a shortcut syntax for reading items by just specifying their name as properties (in lower case) on the TMLPortlet object.
Additionally a portlet may hold "portlet variables" which are special versions of WebTML variables that are only visible in the scope of the portlet they were defined for. Set them via setvar() or portlet.setSessionVar(). Read them - as all WebTML variables - via the this.item method of the TMLContext.
The TMLPortlet object additionally grants control about some status settings of the portlet, like its mode, its position in the portlet hierarchy and the WebTML module that forms its layout. Additionally it can be used to modify the portlet registration, like to register or unregister portlets.
Portlet configurations are stored on the users personalisation profile. Therefor there is neither portlet registration nor portlet configuration available when the user has no profile.
The portlet object that is accessed in TMLScript is normally the object that represents the "current" WebTML portlet available as this.portlet. The current portlet is the portlet whose WebTML code is currently rendered. A portlet is rendered by specifying a <tml:portlet> tag on a WebTML page. If the current TMLScript code is not contained in any <tml:portlet> tag then this.portlet represents the implicit "root portlet" which is available without registration and serves as parent portlet for all manually registered first-level portlets.
All methods and properties of this objects are case insensitive and may be used in arbitrary cases though we recommend using the cases that are used in this documentation.
this.portlet for the "current" WebTML portlet
portlet.getPortletForName() to retrieve a portlet for a specific name
portlet.parentPortlet to retrieve the parent portlet of the "current" portlet
portlet.registerPortletForName() to register a new portlet under a given name
|Allowed in script types||
|Properties and methods||
Reading a portlet item, once in full once in shortform syntax:
Registering a portlet from TMLScript:
var newPortlet = portlet.registerPortletForName("childPortlet", "myportletmodule");