[htmltmpl] LOOP over array of scalar elements
Brought to you by:
samtregar
From: Gabor S. <ga...@pe...> - 2003-12-22 07:49:35
|
It might be a very simple question but I could not find the answer so far: In a larger hash I have an array-ref with simple scalars in it items => [ 'apple', 'banana', 'orange' ] I'd like to use this directly in a H:T with something like the following but I don't know if it's possible ? <TMPL_LOOP NAME="items"> <TMPL_VAR><br> </TMPL_LOOP> So far the only way I could think of is to go over these arrays and replace the scalar values with hash-refs: items => [ {item => 'apple'}, {item => 'banana'}, {item => 'orange'} ] and then I use <TMPL_LOOP NAME="items"> <TMPL_VAR NAME="item"><br> </TMPL_LOOP> thanks Gabor |