mirror of
https://github.com/fenom-template/fenom.git
synced 2023-08-10 21:13:07 +03:00
Add checking nested level for {use} and {extends}
Add more docs
This commit is contained in:
@ -1,22 +1,67 @@
|
||||
Operators
|
||||
=========
|
||||
|
||||
Math
|
||||
### Math
|
||||
|
||||
`+ - / *`
|
||||
Operators: `+ - / *`
|
||||
|
||||
Bitwize
|
||||
```smarty
|
||||
{$a + $b * $c/$d - $e*5 + 1e3}
|
||||
```
|
||||
|
||||
`| & << >> |= &= <<= >>=`
|
||||
### Boolean
|
||||
|
||||
Unary
|
||||
Operators: `|| && and or < > <= >= == === !== !=`
|
||||
|
||||
`^ ~ - !`
|
||||
```smarty
|
||||
{if $a && $b >= 5 && $c != 3} {/if}
|
||||
```
|
||||
|
||||
Boolean
|
||||
### Bitwize
|
||||
|
||||
`|| && and or < > <= >= == === !== !=`
|
||||
Operators: `| & << >> |= &= <<= >>=`
|
||||
|
||||
Ternar
|
||||
```smarty
|
||||
{if $a & 1} {var $b |= $flags} {/if}
|
||||
```
|
||||
|
||||
`? :`
|
||||
### Unary
|
||||
|
||||
Operators: `^ ~ - !`
|
||||
|
||||
```smarty
|
||||
{var $b |= $flags & ^$c}
|
||||
```
|
||||
|
||||
### Ternar
|
||||
|
||||
Operators: `? :`
|
||||
|
||||
```smarty
|
||||
{var $a = true}
|
||||
{$a ? 5 : 10} {* outputs 5 *}
|
||||
{var $a = false}
|
||||
{$a ? 5 : 10} {* outputs 10 *}
|
||||
```
|
||||
|
||||
### Variable operator
|
||||
|
||||
Checking variable value
|
||||
```smarty
|
||||
{if $a?} {* instead of {if !empty($a)} *}
|
||||
```
|
||||
|
||||
Checking variable existence
|
||||
```smarty
|
||||
{if $a!} {* instead of {if isset($a)} *}
|
||||
```
|
||||
|
||||
Get default if variable is empty
|
||||
```smarty
|
||||
{$a?:"some text"} {* instead of {if empty($a) ? "some text" : $a} *}
|
||||
```
|
||||
|
||||
Get default if variable doesn't exist
|
||||
```smarty
|
||||
{$a!:"some text"} {* instead of {if isset($a) ? $a : "some text"} *}
|
||||
```
|
||||
|
Reference in New Issue
Block a user