Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: More with HTML:Template

by mce (Curate)
on Nov 23, 2001 at 14:12 UTC ( [id://127077]=note: print w/replies, xml ) Need Help??


in reply to More with HTML:Template

Hi there,
Why do you declare the Template object twice with new? I stripped down your code to give you an example:
#!/usr/bin/perl #Loads the CGI Module use strict; use CGI; use HTML::Template; # creates a new CGI object my $page = new CGI; # Create a new HTML:Template object my $template = HTML::Template->new(filename => '..\Template\my.tmpl'); # This will print a standard HTML header print $page->header; # Grab a named CGI parameter my $value = $page->param("video"); #Now print out lots of HyperText Mark-up Language using # HTML::Template $template->param(text => $value); print $template->output; exit;
This code works fine for me when I make my template like
<HTML> <TMPL_VAR NAME=text> </HTML>
And, as is correctly stated before, please open the file like:
open(SEE, "< ../$value") or die "The File could not be opened.";
I hope this will send you in the correct direction.
---------------------------
Dr. Mark Ceulemans
Senior Consultant
IT Masters, Belgium
update by mce: I see also that you give an array as a param, this can only be used in TMPL_LOOP situations when the array holds references to a hash

Replies are listed 'Best First'.
Re: Re: More with HTML:Template
by wog (Curate) on Nov 23, 2001 at 21:10 UTC
    open(SEE, "< ../$value") or die "The File could not be opened."

    This is an improvement, but not really secure. There are probably some files the user should not acccess, and this allows (some of) them to be accessed with a bit of guessing on their path. To make this secure one should check to make sure $value only contains a certain set of characters, probably excluding /.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-25 21:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found