Use a symbol reference or #echo command in a document
template
at the place where the value of the symbol is to be substituted in the
text
of the completed document. You can use the #set command in the template
to
specify a default value for a symbol.
Before you begin
The name of a symbol must contain only uppercase and lowercase
letters,
numbers and the special characters dollar ($), underscore (_), hyphen (-),
number sign (#), period (.) and at sign (@). The name is
case-sensitive, so
uppercase letters are regarded as different from lowercase letters.
Procedure
- You can include a symbol reference in a document template by
specifying
the symbol name, preceded with an ampersand (&) and terminated
with a
semicolon (;). For example, the symbol ORDER_NUMBER could be
specified in a template as follows:
Thank you! Your order number is &ORDER_NUMBER;.
- You can also use the #echo command in the document template to
specify a symbol. Specify the symbol name in the command, but do
not use an ampersand and semicolon. For example, the symbol
USER_NAME could be specified as follows:
Welcome to the site,
<!--#echo var=USER_NAME-->!
- You can use the #set command in the template to specify a
default
value for a symbol. For example, you could include the symbol
USER_NAME and set a default value for it as follows:
<!--#set var=USER_NAME value='New User'-->
Welcome to the site,
<!--#echo var=USER_NAME-->!
or as follows:
<!--#set var=USER_NAME value='New User'-->
Welcome to the site, &USER_NAME;!
When either of these templates is used with the default value
for USER_NAME, the document appears as
Welcome to the site, New User!
What to do next
An application program that creates a document using the document
template needs to define values for the symbols that are to be
substituted
when the template is used. If you provide a default value for a symbol,
this
is used if the application does not define a value for that symbol.
Remember
that you must define values for the symbols before, or at the time when,
you
insert the template into the document. You cannot change the substituted
values
of the symbols after the template has been inserted.