mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-08 04:14:27 +02:00
more examples
This commit is contained in:
@@ -147,21 +147,21 @@
|
|||||||
<title>{if} statements</title>
|
<title>{if} statements</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{if $name eq "Fred"}
|
{if $name eq 'Fred'}
|
||||||
Welcome Sir.
|
Welcome Sir.
|
||||||
{elseif $name eq "Wilma"}
|
{elseif $name eq 'Wilma'}
|
||||||
Welcome Ma'am.
|
Welcome Ma'am.
|
||||||
{else}
|
{else}
|
||||||
Welcome, whatever you are.
|
Welcome, whatever you are.
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{* an example with "or" logic *}
|
{* an example with "or" logic *}
|
||||||
{if $name eq "Fred" or $name eq "Wilma"}
|
{if $name eq 'Fred' or $name eq 'Wilma'}
|
||||||
...
|
...
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{* same as above *}
|
{* same as above *}
|
||||||
{if $name == "Fred" || $name == "Wilma"}
|
{if $name == 'Fred' || $name == 'Wilma'}
|
||||||
...
|
...
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
@@ -221,6 +221,25 @@
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</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>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
Reference in New Issue
Block a user