HTML::Template
HTML::Template
(OP)
I have taken this back to basics to troubleshoot an odd problem. I may just be missing something here but I just can't fathom it.
This simple nested loop is displaying all the second loop vars in each section where I want them to be separate.
The code isn't complete here but the script and template should be simple enough to follow.
I need another pair of eyes on it, thanks for looking.
This simple nested loop is displaying all the second loop vars in each section where I want them to be separate.
The code isn't complete here but the script and template should be simple enough to follow.
I need another pair of eyes on it, thanks for looking.
CODE -->
@ITEMS=('ONE','TWO','THREE'); my @S1=('ORANGE','APPLE','CHERRY','PINEAPPLE','GRAPE'); my @S2=('DOG','CAT','FROG','GOAT','SHEEP','CAMEL'); foreach $line (@ITEMS){ my %row_data; $row_data{ITEM} = shift(@S1); for($x=0; $x<2; ++$x){ my %sub_data; $sub_data{SUB_ITEM} = shift(@S2); push(@sub_item_data, \%sub_data); } $row_data{SUB_LOOP} = \@sub_item_data; push(@item_data, \%row_data); } $PageMenu->param(ITEM_LOOP => \@item_data); print $PageMenu->output(); ------- template --------- <TMPL_LOOP NAME='ITEM_LOOP'> it - <TMPL_VAR NAME='ITEM'><br> <TMPL_LOOP NAME='SUB_LOOP'> sub - <TMPL_VAR NAME='SUB_ITEM'><br> </TMPL_LOOP> </TMPL_LOOP>
Keith
www.studiosoft.co.uk