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

You are not logged in

Powered by Interchange version 5.7.0

cgi

Returns the the current value of the named CGI input variable.  Can also set a new CGI value within the current page.

Summary

  • [cgi name]

Parameter Description Default
name The name of the CGI variable whose value you want. None
default Return this value if the named CGI value is missing or false. No
enable_html Allow "<" characters to remain intact in the returned value. No
filter Modify the CGI variable's value (persistent unless keep is also specified). None
keep For use with the filter parameter No
set Set a new value for the named CGI variable. None
hide Don't return the value (useful if set is also used). No
interpolate

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

No

Examples

Tag expansion example

Assuming the value of the CGI variable "foo" is "bar": 

[cgi foo]
bar

Perl example

$Tag->cgi({
    name => $name,
});

or similarly with positional parameters:

$Tag->cgi($name, $attribute_hash_reference);

The following lookup from the $CGI hash reference is more efficient than calling $Tag->cgi(), and yields the same result:

my $result = $CGI->{$name};

Description

Returns the the current value of the named CGI input variable submitted to the current page.  This is similar to [value], except it displays the transitory values that have been submitted with the current request.

When the value is returned, any Interchange and HTML tags present in the value will be escaped.  This prevents users from entering Interchange tags into form fields, which could be a serious security risk.  It also helps prevent HTML injection attacks.

You can also set a new CGI value within the current page.

For instance, if you access the following URI:

http://www.example.com/cgi-bin/pagename.html?foo=bar

then, on the pagename.html page, [cgi foo] will output "bar".

This is the same as $CGI->{foo} in embedded Perl.

Parameters

name

This is the name of the CGI variable whose value you want.

default

This sets a return value in case the named CGI variable is missing or otherwise false.  The following will expand to "Using default":

[cgi name="myname" set="" hide=1]
[cgi name="myname" default="Using default"]

enable_html

Any "<" characters, found in the output value, will normally be converted into "&lt;" for safety reasons.  This conversion can be disabled by setting the "enable_html" parameter true.

filter

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

See the filters category for a list of standard filters.

keep

Set keep=1 if you want the tag to return a filtered result but do not want the filter to modify the CGI value itself in the $CGI hashref.

set

You can change a value with set="new_value".  The tag will return the CGI value you set unless you also pass the hide=1 parameter.

Note that this is only available in new-style tags, for safety reasons.

hide

Setting hide=1 suppresses the tag's return value, which can be useful with the set attribute.

Category:  Interchange tags
Last modified by: Kevin Walsh
Modification date: Monday 13 November 2006 at 9:03 PM (EST)
Home  |  Legal nonsense  |  Privacy policy  |  Donations  |  Contact us