OpenWGA 7.7 - WebTML reference
WebTML tags » include<tml:include linkmedium ="media-key">
Purpose:
Description:
This attribute is only effective for include types that include other WebTML modules.
When an included WebTML module generates URL links to other WebTML pages it normally uses its own media key for the generated link. So the page that is opened via the link has the same media key like the WebTML module that created the link.
This is good in most situations but in some situations is not what is intended. If for example a WebTML module "body" exists in only one media key "html" but is included from modules of multiple other media keys then problems may arise with links generated in "body". They will always use media key "html", even if the module is included inside an outer layout that produces another media key.
In that case the outer layout can explicitly specify a link medium for the included module via the "linkmedium" attribute. The included module (and all deeper included modules) will then use the given media key for URL generation.
Value(s):
Examples:
Imagine your application has a special media key named "ipad". While it actually publishes normal HTML (just like your "html" media key) it contains an optimized version to use your app on a tablet computer. Chances are that inside this media key "ipad" you still want to reuse some WebTML modules that are already available for media key "htm". So you use:
<tml:include medium="html" ref="body"/>
The problem with this approach is, that if the included "body" module generates links then they will point to media key "html". So anyone browsing the app on media key "ipad" will be redirected to media key "html" once a link is clicked.
To prevent this you simply define the linkmedium of the include:
<tml:include medium="html" ref="body" linkmedium="ipad"/>
Or, to keep things dynamic, you calculate the linkmedium to be the same medium that was used for the outer layout, i.e. the "main medium" of the request:
<tml:include medium="html" ref="body" linkmedium="{meta:request/mainmedium}"/>