webgen
Generate an XHTML document from the layout definition and the component definition of a static server page.
webgen{/append} {LayoutFile} {,OutputFile}
Example: webgen
Qualifiers
Qualifier | Description |
---|---|
/append | Appends the generated XHTML document to an existing OutputFile. If OutputFile does not exist, a new file is created. |
Parameters
Parameter | Data Type | Description |
---|---|---|
LayoutFile | String |
Name of the file to be used as a layout definition of the server page; maximum length of 79 bytes. No default extension is provided for LayoutFile. If LayoutFile does not exist, the layout definition of a server page is determined by the $SEARCH_SKELETON assignment setting. |
OutputFile | String |
Name of the file to contain the generated document; string, with a maximum length of 79 bytes. No default extension is provided for OutputFile. If OutputFile does not exist, a new file is created. If OutputFile exists, that file is overwritten, unless the /append switch is used. |
Return Values
Value | Explanation |
---|---|
0
|
No errors detected, all field values transferred. |
< 0 |
An error occurred. $procerror contains the exact error. |
>0 |
Number of times that an unknown field or
entity in the layout definition was skipped while preparing the XHTML document. If the layout definition contains references to fields or entities that are not present in the component definition, this is not considered an error. The affected part of the layout is simply skipped. However, the total number of fields and entities skipped is reported in $status. |
Note: It is recommended that you always check the value of $procerror after webget and before webgen.
Value |
Error constant |
Meaning |
---|---|---|
-31
|
<UGENERR_LICENSE>
|
No license for requested action. Contact your Uniface representative. |
-250
|
<UWEBERR_SKELETON>
|
Layout definition not found or incorrect. For example, the layout is in a separate skeleton file that is not available. |
-251
|
<UWEBERR_OUTFILE>
|
When $web is empty, the output file is not specified or is the same as the layout file. |
-252
|
<UWEBERR_IO>
|
Could not write output file. |
-253
|
<UWEBERR_IO_IMAGE>
|
Could not write image file. |
-254
|
<UWEBERR_ITERATION>
|
Nested iteration over the same entity. |
Use
Use in Static Server Page components.
Description
The webgen statement generates an XHTML document from the layout definitions of a static server page, replacing any field values (marked by <x-subst> and <x-occurrence> elements) with the current values in the component definition. The layout definition may be part of the USP or it may be stored in an external LayoutFile,
- If no parameters are specified, webgen defaults to the current component name for the layout definition and output file.
- If the application was started by the Web Request Dispatcher ($web="wrd") and the OutputFile argument is omitted, the generated document is passed to the web server.
- If the OutputFile argument is specified, the generated document is written to the OutputFile.
The names of LayoutFile and OutputFile are subject to non-DBMS file assignments in the [FILES] section of the assignment file.
Always do a store operation before webgen, because webgen creates different XHTML for fields that are stored in a database.
Note: It is possible to customize the XHTML generated
by webgen. You can generate unique id
attributes for fields,
generate label elements with for
attributes, and add customized code such as
JavaScript to the generated output. For more information, see Customizing the XHTML Generated for USPs.
When an entity in the USP layout is surrounded by
<x-occurrence> tags, HTML fields are created for each occurrence currently
in the component definition. To mark which occurrence is shown, the occurrence number is added to
each field name. Outside <x-occurrence> tags, no occurrence number is
added because it is assumed to be 1
.