summaryrefslogtreecommitdiff
path: root/docu
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2013-10-28 18:09:50 +0100
committerKevin Chabowski <kevin@kch42.de>2013-10-28 18:09:50 +0100
commita77a2ec58947f5fc7cb4023db3b8f8298e2f01f2 (patch)
tree0aa5a38a23f8afc49c4c8bc50ad5edd51f4897d2 /docu
parent55d47c27247e3cdbd88818c0ba98646ee11fb315 (diff)
downloadste-a77a2ec58947f5fc7cb4023db3b8f8298e2f01f2.tar.gz
ste-a77a2ec58947f5fc7cb4023db3b8f8298e2f01f2.tar.bz2
ste-a77a2ec58947f5fc7cb4023db3b8f8298e2f01f2.zip
ste:foreach now has an else clause for empty arrays.
Diffstat (limited to 'docu')
-rw-r--r--docu/language_definition.html8
1 files changed, 8 insertions, 0 deletions
diff --git a/docu/language_definition.html b/docu/language_definition.html
index a21a869..84232de 100644
--- a/docu/language_definition.html
+++ b/docu/language_definition.html
@@ -380,6 +380,14 @@
<code><pre>&lt;ste:foreach array="foo" key="k" value="v" counter="i"&gt;<br /> Number: $i&lt;br /&gt;<br /> Key: $k&lt;br /&gt;<br /> Value: $v&lt;br /&gt;<br /> &lt;br /&gt;<br />&lt;/ste:foreach&gt;</pre></code>
This code will loop through the array <code>foo</code> and return the counter <code>$i</code>, the key <code>$k</code> and the value <code>$v</code> of the current iteration.
</p>
+ <p>
+ There can also be an optional <code>&lt;ste:else&gt;</code> clause, that will be executed, if the input array was empty.
+ </p>
+ <p>
+ Example:<br />
+ <code><pre>&lt;ste:foreach array="foo" value="v"&gt;<br /> &lt;p&gt;$v&lt;/p&gt;<br /> &lt;ste:else&gt;<br /> Array \$foo is empty.<br /> &lt;/ste:else&gt;<br />&lt;/ste:foreach&gt;</pre></code>
+ This code will list all array elements or will display <code>Array $foo is empty</code> if the array <code>$foo</code> is empty.
+ </p>
<h3 id="builtin_infloop">ste:infloop</h3>
<p>Creates an infinitive loop. You can get out of the loop using the <a href="#builtin_break">ste:break</a> tag. Can be used to emulate other loop constructs like while loops.</p>