Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: HTML::Template - Two columns?

by TheoPetersen (Priest)
on Jul 04, 2001 at 00:37 UTC ( #93672=note: print w/ replies, xml ) Need Help??


in reply to HTML::Template - Two columns?

I did this using nested loops, but that means you'll need to transform your array into rows of columns as described in other replies.

My code received a single array of products and turned it into rows of three product elements each. It works thusly:

my @rows; while (@products) { push @rows, { 'loop_products' => [splice @products, 0, 3], }; } $template_body->param( loop_row => \@rows, );
Then in your template, you loop through both arrays:
<TMPL_LOOP NAME=loop_row> <TMPL_LOOP NAME=loop_products> Display one product here. </TMPL_LOOP> </TMPL_LOOP>
Works fine if your columns flow across the row. Enjoy :)


Comment on Re: HTML::Template - Two columns?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://93672]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2015-07-08 06:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (94 votes), past polls