|
ION Script User's Guide: ION Script Tag Reference |
|
The ION_VARIABLE tag is used to insert the value of an ION Script variable into the processed document.
<ION_VARIABLE NAME="$variable" [FORMAT="format string"] />
The name of the variable. Note that when referencing an ION Script variable, the variable name must be prefixed with the $ symbol.
Specifies the C-style printf() formatting string. The syntax for the FORMAT attribute is as follows:
FORMAT="%[flags][width][.precision][type length] specifier"
where
flags is one or more of the following characters:
width is an integer specifying the minimum field width. If the result has fewer characters than the field width, it is padded on the left (or right, if the - flag has been specified). The padding is done with spaces unless the first character of width is a zero, in which case the padding is done with zeros.
precision is an integer preceded by a decimal point specifying the minimum number of digits to appear for the d, o, or x format specifiers, or the maximum number of characters to be printed for the s format specifier. It is also the precise number of digits to display after the decimal (including trailing zeros) for the e, E, f, g, or G specifiers.
type length is one of the following:
specifier is one of the following:
|
ION Variable Type
|
Valid Specifiers
|
|---|---|
|
BOOL, STRING
|
%s
|
|
INT
|
%d, %i, %o, %u, %x, %X
|
|
DOUBLE
|
%e, %E, %f, %g, %G
|
| Note For more information on using format specifiers, refer to a C programming manual. |
The ION_VARIABLE tag is not converted to HTML, and therefore does not accept any other attributes. The value of the specified variable is inserted directly into the HTML stream.
In the following example, we declare a variable, and then insert the value of the variable into the page. Note that in the variable declaration, we use only the variable name without the $ symbol, but when referencing the variable in the ION_VARIABLE tag, we precede the variable name with the $ symbol:
<ION_SCRIPT> <ION_HEADER> <VARIABLES> <VARIABLE_DECL NAME="foo" TYPE="INT" VALUE="5"/> </VARIABLES> </ION_HEADER> <ION_BODY> The value of foo is <ION_VARIABLE NAME="$foo"/> </ION_BODY> </ION_SCRIPT>
The following text is written to the Web page:
The value of foo is 5
IDL Online Help (March 06, 2007)