input|eq( value1 [, value2 ] )
Name | Type | Description | Required |
---|---|---|---|
value1 | any | A variable/value that should be compared. | Yes. |
value2 | any | Another variable/value that should be copmared. | No. |
This operator compares the contents of two or more variables and/or values. If the input parameter is used, the operator will compare it with the first parameter. If the provided variables/values match, the operator will return TRUE, otherwise FALSE will be returned. If more than one parameter is provided, the operator will compare all parameters. If all parameters are found to be equal, the operator will return TRUE, otherwise FALSE will be returned. If more than one parameter is provided, the operator will simply ignore the input parameter.
Note that "eq" compares the values in the same way as the '==' operator in PHP programming language (for example, 0.1 and 0.10 will be equal). Refer to the PHP reference documentation for more information. It is recommended to use the “compare” template operator for string comparision.
{if 1|eq( 1 )} The truth is out there. {else} The day the earth stood still. {/if}
The following output will be produced: "The truth is out there".
{if 1|eq( 2 )} The truth is out there. {else} The day the earth stood still. {/if}
The following output will be produced: "The day the earth stood still".
{if eq( 1, 1 )} The truth is out there. {else} The day the earth stood still. {/if}
The following output will be produced: "The truth is out there".
{if eq( 1, 2 )} The truth is out there. {else} The day the earth stood still. {/if}
The following output will be produced: "The day the earth stood still".
{if 1|eq( 1, 1 )} The truth is out there. {else} The day the earth stood still. {/if}
The following output will be produced: "The truth is out there".
{if 2|eq( 1, 1 )} The truth is out there. {else} The day the earth stood still. {/if}
The following output will be produced: "The truth is out there.".
{if 1|eq( 1, 2 )} The truth is out there. {else} The day the earth stood still. {/if}
The following output will be produced: "The day the earth stood still".
Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2013 eZ Systems AS (except where otherwise noted). All rights reserved.