fenom/docs/en/tags/if.md

44 lines
667 B
Markdown
Raw Permalink Normal View History

2016-04-12 12:28:57 +03:00
Tag {if}
========
2013-02-08 00:46:14 +04:00
2016-04-12 12:28:57 +03:00
Tag {if} have much the same flexibility as PHP [if](http://docs.php.net/if) statements,
with a few added features for the template engine.
All operators, allowed functions and variables are recognized in conditions.
2013-02-11 17:23:22 +04:00
```smarty
{if <expression>}
{* ...code... *}
2013-07-05 00:02:24 +04:00
{elseif <expression>}
2013-02-11 17:23:22 +04:00
{* ...code... *}
{else}
{* ...code... *}
{/if}
```
2013-02-08 14:23:10 +04:00
### {if}
```smarty
2013-07-05 00:02:24 +04:00
{if <expression>}
2013-02-08 14:23:10 +04:00
{*...some code...*}
{/if}
```
### {elseif}
```smarty
2013-07-05 00:02:24 +04:00
{if <expression1>}
2013-02-08 14:23:10 +04:00
{*...some code...*}
2013-07-05 00:02:24 +04:00
{elseif <expression2>}
2013-02-08 14:23:10 +04:00
{*...some code...*}
{/if}
```
### {else}
```smarty
2013-07-05 00:02:24 +04:00
{if <expression>}
2013-02-08 14:23:10 +04:00
{*...some code...*}
{else}
{*...some code...*}
{/if}
2016-04-12 12:28:57 +03:00
```