each loop is just a vector, and the elements of the vetctor are hashtables.
if one of the elements of the hashtable is another vector, you have yourself nested loops.
Template t = new Template(...);
Vector v = new Vector();
Vector v2 = new Vector();
// add some elements to v2
Hashtable h = new Hashtable();
h.put("loop2", v2);
h.put("var1", "variable");
v.addElement(h);
t.setParam("loop1", v);
and your template looks like this:
<tmpl_loop loop1>
<tmpl_var var1>
<tmpl_loop loop2>
vars from loop2
</tmpl_loop>
</tmpl_loop>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
is it posible to have loop inside another loop in a template?
Thank you,
Anton
yes.
each loop is just a vector, and the elements of the vetctor are hashtables.
if one of the elements of the hashtable is another vector, you have yourself nested loops.
Template t = new Template(...);
Vector v = new Vector();
Vector v2 = new Vector();
// add some elements to v2
Hashtable h = new Hashtable();
h.put("loop2", v2);
h.put("var1", "variable");
v.addElement(h);
t.setParam("loop1", v);
and your template looks like this:
<tmpl_loop loop1>
<tmpl_var var1>
<tmpl_loop loop2>
vars from loop2
</tmpl_loop>
</tmpl_loop>