$instancelayout

Return or set the layout property of the current component instance.

Return = $instancelayout { () }

$instancelayout = InstanceLayout

Example: $instancelayout = "<html> Your code here </html>"

Parameters

Parameters
Parameter Data Type Description
InstanceLayout String String, field, or variable that evaluates to a string.

Return Values

Value of the Layout property of the current component instance.

Common Errors

No error codes are generated

Use

Use in Dynamic and Static Server Page components.

Description

Every server page component has a layout property which is set declaratively using the Layout Editor, and read by webgen and weblayout when creating or refreshing a component instance. You can use the $instancelayout function to read the current layout or set a new layout dynamically at runtime.

To apply the new layout, you must invoke webgen (for static server pages) or weblayout (for dynamic server pages).

Using $instancelayout

For example, if you want to change the theme of a hosted Uniface web application based on log-in credentials, you can load the desired layout based on log-in credentials before creating and activating the requested page. The code in the postActivate trigger generates the page, including the layout, sent to the browser.

; Load the stored layout
fileload/raw "..\layouts\acme\DSP1.hts", vWebLayout

;Set the value of $instancelayout 
$instancelayout = vWebLayout

; Create and activate the server page. 
; The web layout stored in $instancelayout is used by the code in the postActivate trigger
newinstance "DSP1", "DSP1_1"
activate DSP1_1.EXEC()
History
Version Change
10.1.01 Introduced

Related Topics