cvs: smarty /docs/en/designers/language-builtin-functions language-function-if.xml
[email protected] ("Messju Mohr") Fri, 09 Dec 2005 14:48:30 -0000
| Newsgroups | php.smarty.cvs |
|---|---|
| Message-ID | <cvsmessju1134139710@cvsserver> |
messju Fri Dec 9 09:48:30 2005 EDT
Modified files:
/smarty/docs/en/designers/language-builtin-functions
language-function-if.xml
Log:
fixed examples.
added mentioning off $security when PHP functions are used with {if}
http://cvs.php.net/diff.php/smarty/docs/en/designers/language-builtin-functions/language-function-if.xml?r1=1.7&r2=1.8&ty=u
Index: smarty/docs/en/designers/language-builtin-functions/language-function-if.xml
diff -u smarty/docs/en/designers/language-builtin-functions/language-function-if.xml:1.7 smarty/docs/en/designers/language-builtin-functions/language-function-if.xml:1.8
--- smarty/docs/en/designers/language-builtin-functions/language-function-if.xml:1.7 Tue Sep 13 14:41:44 2005
+++ smarty/docs/en/designers/language-builtin-functions/language-function-if.xml Fri Dec 9 09:48:28 2005
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.7 $ -->
+<!-- $Revision: 1.8 $ -->
<sect1 id="language.function.if">
<title>{if},{elseif},{else}</title>
<para>
@@ -14,7 +14,11 @@
<emphasis>&&</emphasis>, <emphasis>and</emphasis>,
<emphasis>is_array()</emphasis>, etc.
</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>
The following is a list of recognized qualifiers, which must be
separated from surrounding elements by spaces. Note that items listed
@@ -161,25 +165,29 @@
...
{/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 *}
{if ( $amount < 0 or $amount > 1000 ) and $volume >= #minVolAmt#}
...
{/if}
+
{* you can also embed php function calls *}
{if count($var) gt 0}
...
{/if}
+{* check for array. *}
+{if is_array($foo) }
+ .....
+{/if}
+
+{* check for not null. *}
+{if isset($foo) }
+ .....
+{/if}
+
+
{* test if values are even or odd *}
{if $var is even}
...
@@ -191,11 +199,13 @@
...
{/if}
+
{* test if var is divisible by 4 *}
{if $var is div by 4}
...
{/if}
+
{*
test if var is even, grouped by two. i.e.,
0=even, 1=even, 2=odd, 3=odd, 4=even, 5=even, etc.
@@ -208,18 +218,6 @@
{if $var is even by 3}
...
{/if}
-
-{* ------- if with php functions ------- *}
-{* check for array. *}
-{if is_array($foo) }
- .....
-{/if}
-
-{* check for array. *}
-{if isset($foo) }
- .....
-{/if}
-
]]>
</programlisting>
</example>