Re: simple problem w/ opening files
From: Herr Hardy (schaumfestiger_at_gmx.de)
Date: 05/17/04
- Next message: iain: "Re: Datetime overflow with DBI ODBC setting 19th century dates with placeholders"
- Previous message: Julia deSilva: "Re: PERL calculator"
- In reply to: Mat W: "simple problem w/ opening files"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 17 May 2004 10:16:23 +0200
On Sun, 16 May 2004 12:27:37 -0700, "Mat W" <werbs@cox.net> wrote:
><head><title>$mytitle</title></head>
>
>Now, in the script there are times when i need to print this file. What i
>want to do is first set the variables, then open the file and print the html
>contents.
You could try something like this:
Make your Html-Template to be some Perl-Code
test.html:
# START_FILE
print << "EOF_TEMPLATE";
<head><title>$mytitle</title></head>
EOF_TEMPLATE
1;
#EOF
>For example:
>$mytitle = "TEST";
>open (FILEIN, "./pages/test.html");
>@contents = <FILEIN>;
>close (FILEIN);
>print @contents.
Include this with Perl's 'require' to be executed, not just read
$mytitle = "TEST";
require "/path/to/templates/test.html";
There are some things to be carefully observed (e.g. masking:
email\@mydomain.com instead of email@mydomain.com) and maybe/ surely
some others... but to me it seems like a simple and fast way to solve
a little problem.
Ciao Hardy
- Next message: iain: "Re: Datetime overflow with DBI ODBC setting 19th century dates with placeholders"
- Previous message: Julia deSilva: "Re: PERL calculator"
- In reply to: Mat W: "simple problem w/ opening files"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|