Previous Chapter | Next Chapter | Up | Next Section | Contents

The var Tag


The var tag is used to perform simple variable substitutions. A number of attributes are provided to control how text is to be inserted and formatted. The attributes are summarized in table See var tag attributes.

var tag attributes

Attribute name

Needs an argument?

Description

name

yes

Insert the name of the variable. See "The name attribute" on page 9.

expr

yes

Insert an expression that evaluates a value. See "The expr attribute" on page 9.

fmt

yes

Specify a data format, which may be a special, custom, or C-style format. See Custom, Special, C, and Empty Formats

null

yes

Specify a string to be substituted for null values. See Null Values

lower

no

Convert all upper-case letters to lower case

upper

no

Convert all lower-case letters to upper case.

capitalize

no

Convert the first character of the inserted to upper case.

spacify

no

Convert underscores in the inserted value to spaces.

thousands_commas

no

In a value containing all numbers, insert commas every three digits to the left of a decimal point. For example, "12000 widgets" becomes "12,000 widgets".

html_quote

no

Convert characters that have special meaning in HTML to HTML character entities.

url_quote

no

Convert characters that have special meaning in URLS to HTML character entities using decimal values.

sql_quote

no

Convert single quotation mark to a pair of single quotation marks. This is needed to safely include values in Standard Query Language (SQL) strings.

newline_to_br

no

Convert new-line characters, carriage-return characters, and new-line-carriage-return character combinations to new-line characters followed by HTML break tags.

size

yes

Truncate the value to the given size. See Truncation

etc

yes

Provide a string to be added to truncated text to indicate that truncation has occurred. The default value is "...". See Truncation

Previous Chapter | Next Chapter | Up | Next Section | Contents

SUBSECTIONS