Defines a template file that controls how code will be written by a Wizard based on user input, and which file will be created.
The following subjects are covered in this document:
Related information about VTML and WIZML:
|
TEMPLATE plays a role in the following VTML-driven tools:
This tag defines the name and location of the Wizard (.wml) output template, a file written in WIZML.
<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. |
DESCRIPTION | Description of the Wizard page's function for use in the Wizard Output Summary page. |
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".