http://www.perlmonks.org?node_id=995346

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I have tried below example using Template toolkit, but display page is getting blank.
header.html, footer.html and main.html are kept under /home/userone/public_html/template directory.
Can anyone tell me why I am getting blank page when I call process_template.pl script.
Operating System : Linux
Perl Version : 5.10.1
Apache version 2.2.22

header.html <html> <head> <title>[% title %]</title> </head> <body bgcolor="#ffffff"> <h1>[% title %]</h1> *********************************************** footer.html <div align="center"> [% copyright %] </div> </body> </html> *************************************************** main.html [% PROCESS header title="Some Interesting Links" %] <p> Here are some interesting links: <ul> [% FOREACH link = weblinks %] <li><a href="[% link.url %]">[% link.title %]</a></li> [% END %] </ul> </p> [% PROCESS footer %] *************************************************** process_template.pl #!/usr/bin/perl print "Content-Type: text/html\n\n"; use strict; use warnings; use Template; # create template processor my $tt = Template->new({ INCLUDE_PATH => [ '/home/userone/public_html/template', ], PRE_PROCESS => 'header', POST_PROCESS => 'footer', }); # define data my $data = { copyright => '&copy; 2002 Andy Wardley', weblinks => [ { url => 'http://perl.apache.org/', title => 'Apache/mod_perl', }, { url => 'http://tt2.org/', title => 'template Toolkit', }, ] }; $tt->process('main.html',$data) || die $tt->error(); ********************************

could you please help me to get an output page

Thanks