If request
Contents
Syntax
<txp:if_request>
The if_request tag is a conditional tag and is always used as an opening and closing pair, like this…
<txp:if_request>
…conditional statement…
</txp:if_request>
The tag will execute the contained statements if a page request variable matches the given content.
Attributes
Tag will accept the following attributes (case-sensitive) as well as the global attributes :
match="match type"
- How you wish your value to be tested. Choose from:
exact
: value text must exactly match the request variable.
any
: checks if any of the given comma-separated list ofvalue
s occur anywhere in the request variable.
all
: checks if all of the given comma-separated list ofvalue
s occur anywhere in the request variable.
pattern
: allows you to specify a regular expression in yourvalue
attribute to match against the request variable. - Default:
exact
. name="field name"
- The page request variable name you wish to check.
separator="character"
- If you wish to treat your request variable as a list of items - so that each item is a discrete entity and tested separately when using
any
orall
matching - specify the delimiter that’s used in the variable. This attribute is ignored if usingexact
orpattern
matching. type="server request"
- The variable from which you wish to find a value for comparison. If using
name
it uses thename
value directly. Otherwise it considers the array entry given byname
in thetype
request variable. - Values:
cookie
.
get
.
name
.
post
.
request
.
server
. - Default:
request
. value="field value"
- The variable content you want to check for a match.
Examples
Example 1: Test if the size
parameter (passed in the URL) is one of a set of values.
<txp:if_request name="size" type="get" match="any" value="small, medium, large">
<p>Thanks!</p>
<txp:else />
<p>Please specify a valid size value.</p>
</txp:if_request>
Other tags used: else.
Genealogy
Version 4.8.0
Tag support added.