Name

env — provides read-only access to the HTTP environment variables

ATTRIBUTES

Attribute Pos. Req. Default Description
arg | name Yes     Name of the environment variable to display, if any.
interpolate     0 interpolate output?
hide     0 Hide the tag return value?

DESCRIPTION

The [env] tag provides read-only access to the HTTP environment variables. It can both display a specific variable as-is, or produce a complete list of variables and values in a simple HTML table.

List display is useful for simple debugging or diagnostics.

BEHAVIOR

This tag does not appear to be affected by, or affect, the rest of Interchange.

EXAMPLES

Example: Display the client connection and browser information

The client's remote address and port are kept in REMOTE_ADDR and REMOTE_PORT variables. User's browser ID string is kept in HTTP_USER_AGENT.

Client connection: [env REMOTE_ADDR]:[env name="REMOTE_PORT"]<br/>
Client browser: [env arg="HTTP_USER_AGENT"]

Example: Display the simple HTML table with the complete HTTP environment

HTTP environment: <br/>
[env]

NOTES

AVAILABILITY

env is available in Interchange versions:

4.6.0-5.7.0 (git-head)

SOURCE

Interchange 5.7.0:

Source: code/UserTag/env.tag
Lines: 33


# Copyright 2004-2007 Interchange Development Group and others
# Copyright 2001 Ed LaFrance <edl@newmediaems.com>
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.  See the LICENSE file for details.
# 
# $Id: env.tag,v 1.11 2007-03-30 23:40:57 pajamian Exp $

Usertag env Order      arg
Usertag env PosNumber  1
UserTag env attrAlias  name arg
UserTag env Version    $Revision: 1.11 $
Usertag env Routine    <<EOR
sub {
my $arg = shift;
my $env = ::http()->{env};
my $out;
if (! $arg) {
  $out = "<table cellpadding='2' cellspacing='1' border='1'>\n";
  foreach ((keys %$env)) {
    $out .= "<tr><td><b>$_</b></td><td>";
    $out .= "$env->{$_}</td>\n</tr><tr>\n";
  }
  $out .= "</table>\n";
}
else {
  $out = $env->{$arg};
}
return $out;
}
EOR

AUTHORS

Ed LaFrance, Interchange Development Group

SEE ALSO

var(7ic), button(7ic)

DocBook! Interchange!