Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

perl HTM::Template looping

Status
Not open for further replies.

WolfMan2k

Programmer
May 2, 2001
1
0
0
US
howdy, does anyone know how to make a loop that will display all of the data in a file, inside the template?

let's use this as an example template:
<html>
<head>
<title>foo</title>
<head>
<TMPL_VAR NAME=&quot;bar&quot;>
</html>

and this is what i've got on the script:
#!/usr/bin/perl
use constant HTML::Template;
use constant TMPL_FILE => &quot;template.html&quot;;
my $tmpl = new HTML::Template( filename => TMPL_FILE );

$foofile = &quot;foobar.txt&quot;;

open( TEMPFILESTREAM, $foofile );
my $foofile = <TEMPFILESTREAM>;
close( TEMPFILESTREAM );

###################################
# this is the grey area....how do #
# i make it loop through all the #
# lines of foobar.txt and display #
# them inside the template? #
###################################

print &quot;Content-type: text/html\n\n&quot;,
$tmpl->output;

EOF

thanks in advance,
dom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top