perl - Display array in multi-column table using template tookit? -
i have array of phone numbers. want display these numbers in table, 5 numbers per row. can in template toolkit without modifying data structure?
you can use plugin template::plugin::table:
[% use table(phone_numbers, cols=5) %] [% foreach row in table.rows %] [% foreach item in row %] [% item %] [% end %] [% end %]
phone_numbers
reference phone number array should passed template toolkit. example:
... $data->{phone_numbers} = \@phone_numbers; $template->process('example.tmpl', $data) || die "template processing failed: ", $template->error(), "\n";
Comments
Post a Comment