pete_morgan Mon Mar 13 03:40:01 2006 UTC
Modified files:
/smarty/docs/en/designers/language-builtin-functions
language-function-if.xml
Log:
more examples
http://cvs.php.net/viewcvs.cgi/smarty/docs/en/designers/language-builtin-functions/language-function-if.xml?r1=1.8&r2=1.9&diff_format=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.8
smarty/docs/en/designers/language-builtin-functions/language-function-if.xml:1.9
---
smarty/docs/en/designers/language-builtin-functions/language-function-if.xml:1.8
Fri Dec 9 14:48:28 2005
+++
smarty/docs/en/designers/language-builtin-functions/language-function-if.xml
Mon Mar 13 03:40:01 2006
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.8 $ -->
+<!-- $Revision: 1.9 $ -->
<sect1 id="language.function.if">
<title>{if},{elseif},{else}</title>
<para>
@@ -147,21 +147,21 @@
<title>{if} statements</title>
<programlisting>
<![CDATA[
-{if $name eq "Fred"}
+{if $name eq 'Fred'}
Welcome Sir.
-{elseif $name eq "Wilma"}
+{elseif $name eq 'Wilma'}
Welcome Ma'am.
{else}
Welcome, whatever you are.
{/if}
{* an example with "or" logic *}
-{if $name eq "Fred" or $name eq "Wilma"}
+{if $name eq 'Fred' or $name eq 'Wilma'}
...
{/if}
{* same as above *}
-{if $name == "Fred" || $name == "Wilma"}
+{if $name == 'Fred' || $name == 'Wilma'}
...
{/if}
@@ -221,6 +221,25 @@
]]>
</programlisting>
</example>
+
+
+ <example>
+ <title>{if} with more examples</title>
+<programlisting>
+ <![CDATA[
+{if isset($name) && $name = 'Blog'}
+ {* do something *}
+{elseif $name == $foo}
+ {* do something *}
+{/if}
+
+{if is_array($foo) && count($foo) > 0)
+ {* do a foreach loop *}
+{/if}
+ ]]>
+</programlisting>
+ </example>
+
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
--
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
|