Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^4: creating HTML table

by Cody Pendant (Prior)
on Jul 16, 2007 at 10:29 UTC ( [id://626809]=note: print w/replies, xml ) Need Help??


in reply to Re^3: creating HTML table
in thread creating HTML table

You are making things really really difficult which HTML::Template can make simple.

You don't need any of that <CSTM> nonsense, or the filter callback.

Here's a template which does all you want:

<table> <tmpl_loop name="rows"> <tr <tmpl_if name="__odd__"> class="odd" <tmpl_else> class="even" </tmpl_if> > <td> <tmpl_var name="data"> </td> </tr> </tmpl_loop> </table>

You put the odd-even logic inside the opening TR tag and HTML::Template does the rest. The source code's going to look a bit weird but the browser doesn't care.



Nobody says perl looks like line-noise any more
kids today don't know what line-noise IS ...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (8)
As of 2024-04-18 11:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found