eq equal NE, neq unequal, GT greater than, LT is less than GTE, GE is greater than or equal to LTE, Le is less than equals not non-mod modulo, etc.

Source: Internet
Author: User

eq equal NE, neq unequal, GT greater than, LT is less than GTE, GE is greater than or equal to LTE, Le is less than or not non-mod modulo is [not] div by whether it can be divisible by a number is (not) even is an even is [NOT] The even by $b ($a/$b)% 2 = = 0 is [not] odd whether it's not odd by $b i.e. ($a/$b)% 2! = 0 Example:

Equal/not Equal/greater than/less than/less than or equal/great than or equal/it's needless to say.

The IF statement in Smarty is as flexible and easy to use as the IF statement in PHP, and adds several features to fit the template engine. The if must appear in pairs of/if. You can use the else and elseif clauses. The following conditions can be used to modify the word: EQ, NE, neq, GT, LT, LTE, Le, GTE, GE, is even, is odd, is not even, is not odd, not, MoD, div by, even by, odd by, = =,! =, >, <, <=, >=. When using these modifiers, you must use a null to open the variable or constant.

Example 7-11. If statements

Example 7-11. If statement demo

{if $name eq "Fred"}

Welcome Sir.

{elseif $name eq "Wilma"}

Welcome Ma ' am.

{Else}

Welcome, whatever.

{/if}

{* An example with "or" logic *}

{if $name eq "Fred" or $name eq "Wilma"}

...

{/if}

{* Same as above *}

{if $name = = "Fred" | | $name = = "Wilma"}

...

{/if}

{* The following syntax won't work, conditional qualifiers

Must is separated from surrounding elements by spaces *}

{if $name = = "Fred" | | $name = = "Wilma"}

...

{/if}

{* Parenthesis is allowed *}

{if ($amount < 0 or $amount >) and $volume >= #minVolAmt #}

...

{/if}

{* You can also embed PHP function calls *}

{if count ($var) GT 0}

...

{/if}

{* Test if values are even or odd *}

{if $var is even}

...

{/if}

{if $var is odd}

...

{/if}

{If $var is not odd}

...

{/if}

{* Test if VAR is divisible by 4 *}

{if $var is div by 4}

...

{/if}

{* Test if Var is even, grouped by. i.e.,

0=even, 1=even, 2=odd, 3=odd, 4=even, 5=even, etc. *}

{If $var is even by 2}

...

{/if}

{* 0=even, 1=even, 2=even, 3=odd, 4=odd, 5=odd, etc. *}

{If $var is even by 3}

...

{/if}

eq equal NE, neq unequal, GT greater than, LT is less than GTE, GE is greater than or equal to LTE, Le is less than equals not non-mod modulo, etc.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.