For more information... RTFM!
NAVIGATION
PAGES THAT LINK HERE
ACCOUNT LOGIN

You are not logged in

Powered by Interchange version 5.7.0

var

Summary

  • [var name global filter]

Parameter Description Default
name The name of the Variable to look up. None
global The Variable namespace to use. 0
filter Return a modified version of the variable's value. None
hide

Suppress any output text that would ordinarily be returned from this tag.  (This universal parameter was introduced with Interchange version 5.5.2.)

No
interpolate

Process any Interchange tags found in the text output from this tag.

Yes

Examples

Tag expansion example

[var FOOBAR]
Value of foobar

Perl example

$Tag->var({
    name => $name,
    global => $global,
    filter => $filter,
});

or similarly with positional parameters:

$Tag->var($name, $global, $filter);

Description

This tag gives access to any of the global or local variables that have been created.  See Variable and VariableDatabase.

Direct access to variables is a lot more efficient, i.e. using the __VARNAME__ (local), @@VARNAME@@ (global) or @_VARNAME_@ (local falling back to global), so you should only use this tag where the direct access is unavailable, such as within DirConfig variable files.

Local UserTags, Subs, ActionMaps and other embedded Perl code etc. have direct access to the $Variable hashref for local Variables, but must use $Tag->var('VARNAME',1) to look up the value of global variables.

Global UserTags, GlobalSubs and ActionMaps etc. have direct access to the $::Variable hashref for local Variables, and also have access to the $Global::Variable hashref for global Variables, so they shouldn't need to use this tag at all.

Note

Note

This tag cannot be used to look up the value of HTTP environment variables.  If you need to read the HTTP environment variables then you must use the [env] tag instead.

Parameters

name

The name of the Variable to display.

global

Use one of the following values here:

Value Description Variable syntax
0 Look up the name in the local Variable namespace. __VARNAME__
1 Look up the name in the global Variable namespace. @@VARNAME@@
2 Look up the name in the local Variable namespace.  If not found then look in the global Variable namespace. @_VARNAME_@

The "global" parameter's default value is "0".

filter

Setting filter="filter1 filter2" modifies the output by running it through the specified filter(s).

See the filters category for a list of standard filters.

Category:  Interchange tags
Last modified by: Kevin Walsh
Modification date: Friday 14 September 2007 at 1:23 PM (CDT)
Home  |  Legal nonsense  |  Privacy policy  |  Donations  |  Contact us