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

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -