Go to main content

If request




The if_request tag is a conditional tag and is always used as an opening and closing pair, like this…

    …conditional statement…

The tag will execute the contained statements if a page request variable matches the given content.


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 of values occur anywhere in the request variable.
all: checks if all of the given comma-separated list of values occur anywhere in the request variable.
pattern: allows you to specify a regular expression in your value attribute to match against the request variable.
Default: exact.
name="field name"
The page request variable name you wish to check.
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 or all matching - specify the delimiter that’s used in the variable. This attribute is ignored if using exact or pattern matching.
type="server request"
The variable from which you wish to find a value for comparison. If using name it uses the name value directly. Otherwise it considers the array entry given by name in the type request variable.
Default: request.
value="field value"
The variable content you want to check for a match.


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">
<txp:else />
    <p>Please specify a valid size value.</p>

Other tags used: else.


Version 4.8.0

Tag support added.

If you notice any kind of problem with this page's construction or content (outdated information, typos, broken links, or whatever), open an issue to have it sorted. Or have a go at it yourself. :)