uthtmgen.wbb - Generate HTML Tags and Text from a Template

Syntax

CALL "uthtmgen.wbb",tpl$, flds$, captions$, flags$, captags$, linkexprs$, work$Description

Description

This high-level program generates a data page in HTML format, based on a template and other information. It is capable of creating data as loose text, preformatted and aligned text, or as a bordered or borderless table.

Parameter

Description

tpl$

Data template that contains both the fields and data to generate the didsplay fields. Various user attributes can be defined in the template to control how field data is handled. See Data Templates for additional information on these attributes.

flds$

Text string that contains a comma-delimited list of field names and optional format options. If flds$ is null, a default list is generated from all the fields in tpl$. flds$ can refer to individual array elements (name-n), or it can refer to all array elements (name-*), in which case the form is generated with all defined array elements separated by a <BR> tag within the column. If flds$ begins with "*,", it is presumed to contain a list of exceptions, so that all the fields in the template tpl$ are used to generate the HTML output. Those found in flds$ are referenced with the formatting tags included in flds$ For example, if flds$ contained the data "*,giffile @image", then all fields in the template would be generated, and the field "giffile" would be treated as an image reference. If flds$ begins with "!,", then all fields in the template, except those listed after the first comma, are included in the generated document. See uthtmout.wbb for formatting options.

captions$

String template that can contain captions for any field to be included in the form. Specifically, any in flds$, or if flds$ is null, then any field in tpl$. The data for any field found in captions$ is used as the caption for the field. If a field to be used on the form is not present in captions$, and a "caption" user attribute is not present in the template string, a default caption is generated from the field name by converting underscores to spaces and formatting the name with the proper case. Note that a null field in captions$ results in no caption for that field.

linkexpr$

Text string used by "uthtmout.wbb" to generate any href links from the records to another page. See uthtmout.wbb for additional information.

flags$

Text string containing various formatting controls in any order. The flags supported are listed in the table below.

captags$

Text string that contains any tag used to format the captions before placing them in the HTML form. This string is used in a CALL to uttags.wbb. Refer to that program page for additional information.

linkexpr$

Link expression that may contain one or more link definitions to use if any data field contains the @link lead-in option. If multiple link expressions are contained in linkexpr$, they must be separated by an ASCII character 1 - $01$. An example of a link expression links a record in a list to a full-page display of that particular record. Typically, the full-page display is based on the record's key field. Here is an example, assuming there is a script that will be given the records key through the ID field:

linkexpr$="/cgi-bin/showpage?ID=[ID @encode]"

Note that uthtmout.wbb is CALLed recursively to format the actual URL used in the link, so the same formatting information applies to text$ and linkexpr$.

work$

Text string that returns the HTML document with captions and data fields.

 

Flag

Description

table

Formats the captions and input fields in table columns, one row per field.

tre

Use pre-format tags to format the form, allowing perfect column alignment without relying on table structures but using fixed pitch fonts.

<p>

Indicates there should be extra space between each row.

align=value cellalign=value

For tables, sets horizontal alignment of the caption or cell to value, typically left or right.

valign=value

For tables, sets vertical alignment to value, such as top or bottom.

font=value hdrfont=value

Add <font value> and </font> tags to the text in cells and captions, respectively. Because there can be no spaces in value, use underscores for multiple options. For example: font=size=4_color=blue.

cellopt=value hdropt=value

When the table option is used, add value to the end of the <td> and <th> tags, respectively. No spaces are allowed. For multiple options, these are separated with an underscore (see above.)

border border=n

For table forms, there should be a border around each cell.

right

Captions are placed to the right of the input fields.

top

Captions are placed above the input fields. In addition, if the "pre" or "table" is specified, the data is arranged in columns, and array values in the template are scrolled within the column.