Re: Perl + Dreamweaver?
- From: Gunnar Hjalmarsson <noreply@xxxxxxxxx>
- Date: Tue, 19 Apr 2005 14:15:41 +0200
Nikos wrote:
What i want to do is "Separation of HTML and code".
That's what HTML::Template, or any templating system, would help you with.
I though that i can create my fancy hmtl page with dreamweaver and then somehow(dont know how) join my code and html so they work together) Is that possbile with dreamweaver? i must somehow create the html too...
If you please give a simple example of how can i simple perl script work with html::template i would be grateful. I took a look at perldoc.com but i didnt understand it.
Even if HTML::Template is slightly more sophisticated, the example below illustrates what the whole thing is about. Assume this in mytemplate.html:
<html><head><title>%HEADER%</title></head> <body><h1>%HEADER%</h1> <p>This is a %VAR1% for illustrating the principles with a %VAR2%.</p> </body></html>
and this CGI script:
#!/usr/bin/perl -T
use strict;
use warnings;
use CGI;
my $q = CGI->new;
my %tmplvar = (
HEADER => 'My Template',
VAR1 => 'template',
VAR2 => 'templating system',
);
open my $tmpl, '<', 'mytemplate.html' or die $!;
my $output = do { local $/; <$tmpl> };
$output =~ s/%([^%\s]+)%/$tmplvar{$1} or "%$1%"/eg;
print $q->header, $output;
__END__I don't use Dreamweaver, but I suppose that you can use it to edit such a template to your liking.
HTH
-- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl .
- Follow-Ups:
- Re: Perl + Dreamweaver?
- From: Nikos
- Re: Perl + Dreamweaver?
- References:
- Perl + Dreamweaver?
- From: Nikos
- Re: Perl + Dreamweaver?
- From: Lord0
- Re: Perl + Dreamweaver?
- From: Nikos
- Perl + Dreamweaver?
- Prev by Date: Re: Perl + Dreamweaver?
- Next by Date: Re: How to export constants to a module?
- Previous by thread: Re: Perl + Dreamweaver?
- Next by thread: Re: Perl + Dreamweaver?
- Index(es):
Relevant Pages
|