Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: working with templates

by GertMT (Hermit)
on Apr 24, 2007 at 20:32 UTC ( [id://611845]=note: print w/replies, xml ) Need Help??


in reply to Re^2: working with templates
in thread working with templates

alright thanks it works:
#!/usr/bin/perl -w use strict; use diagnostics; use Data::Table; use HTML::Template; open( OUT, ">itworks.html" ) or die "cant open out $!"; my $table = new Data::Table( [ [ 1, 2, 3 ], [ 10, 20, 30 ] ], [ 'A', ' +B' ], 1 ); my @newCol2 = (); $newCol2[ $table->nofRow - 1 ] = undef; # print $table->html; my $template = HTML::Template->new( filename => 'template.tpl' # loop_context_vars => 1, # filter => \&cstmrow_filter ); $template->param( my_table => $table->html ); print OUT $template->output;
template.tpl
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" +> <title>It Works</title> <meta name="generator" content="TextMate http://macromates.com/"> </head> <body bgcolor="silver"> <center> <h1 id="just_a_sample_table">Just a sample table</h1> <tmpl_var name="my_table"> <pre>2007-04-24</pre> &copy; ... ; ) </center> </body> </html>
THANKS!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2024-04-23 10:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found