Use
Use in Dynamic Server Page components.
Description
webdefinitions loads the following information into $webinfo channels:
- Component definitions for the current
component are loaded into the
Definitions
channel. These definitions can include properties, initial values, and valrep lists. - Names of JavaScript files for the current
component's web widgets are loaded into the
JavaScript
channel. - All references to CSS files in the current
component are loaded into the
css
channel.
By default, the data is appended to each channel. This allows multiple component definitions to be handled by one channel without ProcScript intervention. If this behavior is not desired, you must explicitly clear each channel before calling webdefinitions.
The webdefinitions statement ensures that both the CSS and the JavaScript channels do not contain duplicate references to CSS or JavaScript files.
Example: postActivate Trigger for DSP
The default code of the DSP postActivate trigger generates the initial page or a page updated, depending on the value of $webresponsetype. The following example shows a simplified version of this code (excluding the error handling.)
trigger postActivate selectcase $webresponsetype case "UPDATE" ; Update page websave ; Generate data case "FULLPAGE" ; Initial page weblayout ; Generate layout webdefinitions ; Generate component definitions websave ; Generate data endselectcase end; postActivate
In this example myScript.js
is assigned to $webinfo("javascript")
. When
webdefinitions is called, the necessary JavaScripts for the current component
are added.
; assign mySscript.js $webinfo("javascript") = "myScript.js" putmess $webinfo("javascript") ; only myscript.js is printed ; Running web definitions appends the default javascript files. webdefinitions
Version |
Change |
---|---|
9.4.01 |
Introduced |