The {{Value}} Tag

This tag looks up a value on the server and the tag is replaced with that value.

Value (variable|”variable” [, source] [,operations]…)

By default, variable is a server variable or a special variable (described below). However, options can direct that the value be obtained from the environment, the server configuration, a submitted form, a cookie, or a query parameter.

On BIS/IIS, if variable is enclosed in quotes, the variable name is treated as a literal string and is not resolved further unless one of the source options below is specified.

On BIS/Apache, if variable begins with a quote, it is treated as a literal and no source option is permitted.

Either single or double quotes may be used as delimiters, and a delimiting quote may be embedded in the string by specifying the quote twice: "abc'""def" becomes abc"def.

The source option determines from where the variable value is obtained. If specified, the source must be the second parameter.

SERVER Specifies that variable is a server variable. This is the default if none of the other sources below are specified and if the string is not quoted. Under BIS/Apache, ENV and SERVER are identical.
CONFIG Specifies that variable is a special server configuration value. A list of CONFIG variables appears at the end of this section.
COOKIE Specifies that variable is a cookie.
ENV Specifies that variable is an environment variable instead of a server variable. Note that, on BIS/Apache, ENV and SERVER are identical. See Setting Environment Variables for information about setting and modifying environment variables on Windows.
FORM Specifies that variable is a <form> variable.
QUERYPARAM

QP

Specifies that variable is a URL query parameter. QP is accepted as an alias for QUERYPARAM .

These operations modify the retrieved value and are applied from left to right and may be applied multiple times.

DEFAULT=value

Specifies a default value for variable if the variable is empty. This option has no effect unless the variable is empty at the point the DEFAULT operation is performed.

  • If the variable is empty when the end of the entire operations list is reached, the Value tag is simply removed from the output stream.
  • If DEFAULT is encountered and the variable is empty, the tag is replaced by value. If there are additional operations to the right of the DEFAULT operation (that is, GETDIR , TOUPPER, URLENCODE), these are performed on the new defaulted value.
GETDIR Same as GETPATH

(see below), except only the directory portion of the pathname is extracted. This is the part of the pathname that follows the scheme and hostname up to the last slash in the pathname. Note that if variable is a pathname that contains a drive letter, the drive letter is also returned. The extracted pathname never ends in a slash.

GETQUERYSTRING If variable is a URL, returns the query string. If not present or if variable is a pathname, an empty string is returned.
GETHOST If variable is a URL, extracts the hostname. If variable is a pathname, or no host name is present, an empty string is returned.
GETNAME Same as GETPATH , except only the filename portion of the pathname is extracted. This is the part of the pathname that follows the last slash but excludes the #fragment , ?querystring, and ;parameters.
GETPATH If variable is a URL, extracts the path portion of the URL. This is the portion of the URL that excludes the scheme, the hostname, and the query string. If variable is a pathname, it is unchanged.
GETSCHEME If variable is a URL, extracts the scheme. This will normally be http or https without the terminating colon or slashes. If variable is a pathname or a URL without a scheme, an empty string is returned.
SUBSTITUTE= pattern/replacement/

SUB=/pattern/replacement/

Allows you to substitute all occurrences of pattern in the value with a replacement pattern. The operation is performed on the current value after all transforms to the left have been performed. Processing continues with the modified value.

SUB is accepted in place of SUBSTITUTE for brevity. Both pattern and replacement are regular expressions. (For more information, see Regular Expression Syntax).
TOUPPER Converts the value to all upper-case characters. Equivalent to SUBSTITUTE="/.*/\U&/".
TOLOWER Converts the value to all lower-case characters. Equivalent to SUBSTITUTE="/.*/\L&/".
URLDECODE Decodes a string that has been URL-encoded. This is primarily useful when retrieving a server variable.
URLENCODE Encodes a string for reliable HTTP transmission from the web server to a client as a URL. For example, This is a <Test String>. will be encoded as: This%20is%20a%20%3cTest%20String%3e.
HTMLDECODE Decodes a string that has been HTML-encoded. This is primarily useful when retrieving a server variable.
HTMLENCODE Encodes a string for reliable HTTP transmission from the web server to a client as HTML. For example, This is a <Test String>. will be encoded as: This is a &lt;Test String&gt;.
MAKEABS Assumes that the string is a relative URL, and makes the URL absolute, using the location of the stencil that was requested by the client as the base URL (see REQUEST_URL in Configuration Variables for details). If the string is not a URL, it is not altered. If the input string is an absolute URL, it is cleaned up (that is, redundancies such as dir/../ are removed) but is otherwise unchanged.

See RFC 3986 for details about how relative URLs are resolved by this operation.

Processing stops when the following option is encountered and the tag always renders as an empty string.

MATCH=regexp Applies the regular expression against the current value and returns true if it matches and false if it does not match but does not return any text for rendering. This allows Value to be used in If tags. See Regular Expression Syntax.

For example, the tag:

{{ VALUE (HTTP_URL, GETDIR, TOLOWER, URLENCODE) }}

is replaced by the directory that contains the page that is currently being served. The name of the directory is converted to lowercase and the directory name is URL-encoded (for example, recommended if the value will be substituted into an HREF attribute). HTTP_URL is a server variable, but it is not necessary to specify the SERVER source parameter because this is the default.