TEMPLATEVTML 2

Defines a template file that controls how code will be written by a Wizard based on user input, and which file will be created.

Location

Function

This tag defines the name and location of the Wizard (.wml) output template, a file written in WIZML.

Syntax and Attributes

<TEMPLATE .../>
NAME Required. File name of the Wizard (.wml) output template. An empty string is not allowed.
OUTPUTFILE Required. Name of the file to write output to based on the results of processing the template. An empty string is not allowed.
OUTPUTPATH Output folder for the file. Defaults to the value of the special parameter LOCATION.
OUTPUTOPTION OpenDoc/CurrentDoc/NewDoc. OpenDoc places the wizard output into the file specified in OUTPUTFILE, then opens the file in the editor. CurrentDoc inserts the wizard output at the cursor position in the active document. NewDoc places the wizard output into a new, blank, untitled document.
DESCRIPTION Description of the Wizard page's function for use in the Wizard Output Summary page.

Usage Notes

OUTPUTPATH
If the attribute OUTPUTPATH is not specified, its value defaults to the current value of the special parameter LOCATION which always contains the current path of the Local tab in the Resource panel.

You can provide a wizard page where the user can specify a (different) value for OUTPUTPATH in a TextBox control. This control can be initialized with the current value of LOCATION parameter by binding the control to it with an INPUT tag:

    <PAGELAYOUT>
        <CONTROL TYPE="TextBox" NAME="editLocation" WIDTH=100/>
    </PAGELAYOUT>
    <INPUT NAME="editLocation" PARAM="Location" REQUIRED="True"/>
    ....
    <TEMPLATE NAME="Custom.wml" OUTPUTFILE="MyFile.html" OUTPUTPATH="$$Location" DESCRIPTION="New HTML file">

An absolute path (starting with '/') without a drive letter will be relative to the root of the program installation drive. A relative path will be relative to the program installation folder (not the folder where the Wizard is located!). The syntax rules are the same as those for bitmap images.

Creating multiple files
You can make a Wizard write several output pages by defining a Wizard output template file for each page, and including as many corresponding TEMPLATE tags in the Wizard profile file. Example:

    <TEMPLATE NAME="Mywizard.wml" OUTPUTFILE="mypage.html" DESCRIPTION="First page"/>
    <TEMPLATE NAME="Mywizard2.wml" OUTPUTFILE="mypage2.html" DESCRIPTION="Second page"/>

Conditionally writing files
It is not possible to define a condition for TEMPLATE and both NAME and OUTPUTFILE must have a non-blank value. However, if the Wizard output template defined in a TEMPLATE tag does not actually write any output (because output is made dependent on certain conditions) then the corresponding output file will not be created. If a file of the same name already existed, it is left unchanged. Example Wizard output template:

<WIZIF Find(Image, "gif")>
<IMG SRC="$$Image" ALT="chosen GIF image">
</WIZIF>

An output file (with a single IMG tag) will be written only if the variable Image contains the string "gif".

top