OpenWGA 7.6 - OpenWGA Concepts and Features

Design and development » WebTML » Basic concepts » Options

Inline options

A special option type is called "inline option" and can be created via tag <tml:inline>, which is a descendant of <tml:option>. It however is used the same way:

<tml:inline name="body">


  <li>  <a href="<tml:url/>"><tml:meta name="title"/></a>


</tml:inline>

An inline option differs from regular options by the fact, that its option value is not determined on option definition. Instead the WebTML code that the <tml:inline> tag defines is stored internally and executed when the option is retrieved. That way the option value is determined, which may be an individual value every time the option is retrieved. Retrieval is again done with a regular <tml:option> tag in "get" mode:

<ul>

  <tml:children>

    <tml:option name="body"/>

  </tml:children>

</ul>

This has some advantages over regular options in some situations:

  • The WebTML generating the option value is executed under the context of the <tml:option> tag which retrieves it (rather than the one which defines it). When you retrieve the option in the context of three different contents you may get three different option values which reflect the current content. That way the example above lets inline option "body" generate individual HTML links for individual contents
  • The option value is internally only a pointer to the stored WebTML contents of the tag and is very small. This is of advantage when the option is used in an AJAX-enabled WebTML portlet, which transports the value all its active options along every single AJAX request.

There are however also some downsides when using inline options, described in more detail on the <tml:inline> tag documentation:

  • It is not cascadeable inside the same WebTML. When you want to use an <tml:inside> inside the contents of another <tml:inside> these must go into different WebTML modules.
  • Its value cannot be retrieved via TMLScript, only via WebTML tag <tml:option>
  • It defaults to scope "local" and should in most situations be used like that to keep it from retrieving itself again and producing a stack overlow