XSSI variables are set in a couple of different ways. You can set your own with the set command, or you can use one of the variables that is set automatically for each browser when it requests a page. To see the list for a specific browser, simply include the <!--#printenv" --> command, which outputs a list of what are called environment variables for your specific case. The output of printenv looks like:
HTTP_USER_AGENT = Mozilla/4.0 [en] (WinNT; I)
The first part (in uppercase) is the name of the variable. The second part (after the equals sign) is its value.
In XSSI code, the variable is referred to either simply by name or with a preceding $. The $ is necessary in contexts in which it's unclear as to whether it's a variable. For example, in the echo command <!--#echo var="variable name" -->, the only thing that can be echoed is a variable (that's why it says "var="), so you don't need the $. On the other hand, in an include statement (<!--#include virtual="$daUrl" -->), you need the $ to specify that daUrl is a variable.
Some of the more useful environment variables are:
-
HTTP_REFERER
- This is the page that linked to the current page.
HTTP_USER_AGENT
- This describes the browser that's being used. This is how we serve different pages to Navigator and Explorer.
QUERY_STRING
- If the URL requested has a "?" and some text at the end, this text is stored in this variable.
PATH_INFO
- If the requested URL has extraneous directories at the end, this information is stored in this variable.
There are also several standard XSSI variables, including:
DATE_GMT
- The current date and time (can be formatted with the config command)
DOCUMENT_NAME
- The filename of the document requested by the user
next page»