I haven’t used Smarty for a project for a long time. Today I suddenly have to change some things in my website, because my website was made with the smarty template engine a long time ago. After changing some parts, I feel that it is not enough. I searched the Internet for answers. It seems that I am already unfamiliar with smarty, which I haven’t seen for a long time. I need to catch up on it quickly. Let’s briefly summarize the logical operation symbols of Smarty templates for future use.
eq equal : equal
neq not equal:not equal to
gt greater than: greater than
lt less than: less than
lte less than or equal:less than or equal
gte great than or equal:greater than or equal
is even: It is an even number
is odd: It is an odd number
is not even: not an even number
is not odd is not an odd number
not: 🎜>
mod: Find the modulus and remainder
div by: quilt. . . except
&& and : And
|| or : or
is [not] div by Whether it can be divided by a certain number, for example: {if $smarty.get.age is div by 3}...{/if}
is [not] even Whether it is an even number, for example: $a is [not] even by $b, that is ($a / $b) % 2 == 0,
is [not] odd Whether it is odd, for example: $a is not odd by $b, that is ($a / $b) % 2 != 0
{if $_global_password!==''} is to judge whether the variables are not equal to empty....
The if statement and if in Smarty must appear in pairs with /if. Else and elseif clauses can be used.
Use 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 in the template , ==, !=, >, <, <=, >= these logical operation symbols must be separated from variables or constants by spaces. Articles you may be interested in