mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
fixed examples.
added mentioning off $security when PHP functions are used with {if}
This commit is contained in:
@@ -14,7 +14,11 @@
|
|||||||
<emphasis>&&</emphasis>, <emphasis>and</emphasis>,
|
<emphasis>&&</emphasis>, <emphasis>and</emphasis>,
|
||||||
<emphasis>is_array()</emphasis>, etc.
|
<emphasis>is_array()</emphasis>, etc.
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
If <link linkend="variable.security">$security</link> is enabled
|
||||||
|
then <emphasis>IF_FUNCS</emphasis> array in the <link
|
||||||
|
linkend="variable.security.settings">$security_settings</link> array.
|
||||||
|
</para>
|
||||||
<para>
|
<para>
|
||||||
The following is a list of recognized qualifiers, which must be
|
The following is a list of recognized qualifiers, which must be
|
||||||
separated from surrounding elements by spaces. Note that items listed
|
separated from surrounding elements by spaces. Note that items listed
|
||||||
@@ -161,25 +165,29 @@
|
|||||||
...
|
...
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{*
|
|
||||||
the following syntax will NOT work, conditional qualifiers
|
|
||||||
must be separated from surrounding elements by spaces
|
|
||||||
*}
|
|
||||||
{if $name=="Fred" || $name=="Wilma"}
|
|
||||||
...
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
|
|
||||||
{* parenthesis are allowed *}
|
{* parenthesis are allowed *}
|
||||||
{if ( $amount < 0 or $amount > 1000 ) and $volume >= #minVolAmt#}
|
{if ( $amount < 0 or $amount > 1000 ) and $volume >= #minVolAmt#}
|
||||||
...
|
...
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
{* you can also embed php function calls *}
|
{* you can also embed php function calls *}
|
||||||
{if count($var) gt 0}
|
{if count($var) gt 0}
|
||||||
...
|
...
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
{* check for array. *}
|
||||||
|
{if is_array($foo) }
|
||||||
|
.....
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{* check for not null. *}
|
||||||
|
{if isset($foo) }
|
||||||
|
.....
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
{* test if values are even or odd *}
|
{* test if values are even or odd *}
|
||||||
{if $var is even}
|
{if $var is even}
|
||||||
...
|
...
|
||||||
@@ -191,11 +199,13 @@
|
|||||||
...
|
...
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
{* test if var is divisible by 4 *}
|
{* test if var is divisible by 4 *}
|
||||||
{if $var is div by 4}
|
{if $var is div by 4}
|
||||||
...
|
...
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
{*
|
{*
|
||||||
test if var is even, grouped by two. i.e.,
|
test if var is even, grouped by two. i.e.,
|
||||||
0=even, 1=even, 2=odd, 3=odd, 4=even, 5=even, etc.
|
0=even, 1=even, 2=odd, 3=odd, 4=even, 5=even, etc.
|
||||||
@@ -208,18 +218,6 @@
|
|||||||
{if $var is even by 3}
|
{if $var is even by 3}
|
||||||
...
|
...
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{* ------- if with php functions ------- *}
|
|
||||||
{* check for array. *}
|
|
||||||
{if is_array($foo) }
|
|
||||||
.....
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{* check for array. *}
|
|
||||||
{if isset($foo) }
|
|
||||||
.....
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
Reference in New Issue
Block a user