Variable substitution
Variable replacement takes place in the HTML files served by WebPoint. Before a page is sent to a
client it is processed. Scripts are executed, and all variables are substituted
by their values.
Syntax
Variable substitution can happen anywhere in the HTML source code. WebPoint looks for a special tag
and replaces this tag with the value of the variable which can be any text. Since only text replacement
is done the value can also contain HTML tags or JavaScript, anything that is allowed by HTML. The client
browser is seeing only the substituted text.
To access a variable in HTML text, use the following syntax:
<!Variable_Name>
with Variable_Name being the first parameter to the SetSessionValue function when the variable
has been set.
To output e. g. the result of a calculation done on the server—stored in the session variable "Result" in a
previously executed script—use the following code:
<p>
Result: <b>$<!Result></b>
</p>
The output will be:
Result: $500
Constants
Constants specified in the settings.ini file can be accessed in
a similar way. The same special tag is used, along with the specifier Constant:
<!Constant Constant_Name>
with Constant_Name the name of the constant as specified in settings.ini.
If e. g. the usual paths have been set as proposed on the settings page, they can be used as follows to load the page images:
<img src="<!Constant ImagePath>picture.gif">
Variable and constant substitution is done recursively. The result of a variable or constant is again
processed by WebPoint, so that variables in the variable values are replaced as well. If the image path
in the above example is composed of the "base_path" and the "image_folder", you will get the complete path
in two steps: <!Constant ImagePath> -> <!Constant BasePath>image_folder/ -> ../base_path/image_folder/.
WebPoint provides a number of built-in values that can be inquired through variables:
| Variable | Meaning |
<!WebServer> |
Protocol and DNS name of the server for the request, e. g. http://www.intouch.com.au. |
<!Runner> |
Name of and path to the runner, i. e. the WebPoint extension, e. g. /MyWebSite/eCommerce/wp.dll. |
<!AppID> |
The application ID of the web application WebPoint is currently running. This is the same name as the base
folder of the application |
<!SessionID> |
This is the number identifying the session the server currently maintains for the calling client, e. g. 1022110201515658.
The number is generated by the server in case none ID has been specified in the URL, or transmitted by the client. |
Some of this information is delivered to WebPoint through the URL, e. g. the Application ID and the Session ID.
Often this information is used by scripts to generate new URLs for links or form submission actions:
<!WebServer><!Runner>?<!AppID>:<Next_Script_File>:<!SessionID>
Syntax for XML
In general, the same syntax can be used for both HTML and XML. However, if it is found that the use of angle brackets is illegal in an XML file, square brackets may be substituted instead. For example:
[!Constant Constant_Name]
|