geirm 00/10/31 11:17:57
Modified: test/templates foreach-array.vm
test/templates/compare foreach-array.cmp
Log:
Added the in-template array #set and use in #foreach().
Revision Changes Path
1.4 +8 -0 jakarta-velocity/test/templates/foreach-array.vm
Index: foreach-array.vm
===================================================================
RCS file: /home/cvs/jakarta-velocity/test/templates/foreach-array.vm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- foreach-array.vm 2000/10/31 16:07:26 1.3
+++ foreach-array.vm 2000/10/31 19:17:54 1.4
@@ -30,3 +30,11 @@
</tr>
#end
</table>
+
+-- And when we declare the array in-template :
+
+#set $colors=["red","blue","green"]
+Choose among :
+#foreach( $color in $colors )
+ $color
+#end
1.3 +9 -2 jakarta-velocity/test/templates/compare/foreach-array.cmp
Index: foreach-array.cmp
===================================================================
RCS file: /home/cvs/jakarta-velocity/test/templates/compare/foreach-array.cmp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- foreach-array.cmp 2000/10/31 16:07:28 1.2
+++ foreach-array.cmp 2000/10/31 19:17:56 1.3
@@ -5,10 +5,10 @@
<table>
<tr>
- <td>This is first element and it is the 1 item</td>
+ <td>This is $element and it is the 1 item</td>
</tr>
<tr>
- <td>This is second element and it is the 2 item</td>
+ <td>This is $element and it is the 2 item</td>
</tr>
</table>
@@ -16,3 +16,10 @@
<table>
</table>
+
+-- And when we declare the array in-template :
+
+Choose among :
+ red
+ blue
+ green