4.12. cgi
Returns the the current value of the named CGI input variable. HTML-escapes Interchange tags in the result for security.
Can also set a new CGI value within the current page.
4.12.1. Summary
[cgi name] [cgi name=cgi_var_name other_named_attributes]
Parameters | Description | Default |
name | This is the name of the CGI variable whose value you want. | None |
Attributes | Default |
set | none |
hide | No |
filter | none |
keep (with filter) | No |
enable_html | No |
interpolate (reparse) | No |
Other_Characteristics | |
Invalidates cache | Yes |
Tag expansion example:
Assuming CGI variable 'foo' = 'bar',
[cgi foo] --- bar
ASP-like Perl call:
$Tag->cgi( { name => var_name } ); # or if you simply want the value: $CGI->{var_name}; # or: $CGI::values{var_name};
or similarly with positional parameters,
$Tag->cgi($name, $attribute_hash_reference);
4.12.2. Description
Displays the value of a CGI 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.
For instance, if you access the following URL:
http://VENDURL/pagename?foo=bar
bar will be substituted for [cgi foo].
This is the same as $CGI->{foo} in embedded Perl.
4.12.2.1. name
This is the name of the CGI variable whose value you want.
4.12.2.2. set
You can change a value with 'set=new_value'. The tag will return the CGI value you set unless you also set the hide=1 attribute.
Note that this is only available in new-style tags, for safety reasons.
4.12.2.3. hide
Setting hide=1 suppresses the tag's return value, which can be useful with the set attribute.
4.12.2.4. filter
See the filter tag for a list of filters.
Setting 'filter="filter"' modifies the named CGI variable with the specified filter.
4.12.2.5. keep (with filter)
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::values hash.
4.12.2.6. 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=0 hide=1] [cgi name=myname default="Using default"]
4.12.2.7. enable_html
Any '<' characters will normally be converted into '<' for safety reasons. This conversion can be disabled using 'enable_html=1'.