Francesco,
Are you hoping to generate static content from your templates, or have them generated
dynamically? If you're thinking of the latter, consider something like this:
========
index.pl
========
#!/usr/bin/perl -Tw
use strict ;
use Template ;
use CGI ;
my $q = new CGI ;
my $lang = $q->param( 'lang' ) ;
my %langs = map { $_ => 1 } qw( en fr ) ;
die "Sorry, I don't know that language."
unless $langs{ $lang } ;
my $page = $q->param( 'page' ) ;
my $ttml = "$page.$lang.ttml" ;
my $tt = new Template {
INCLUDE_PATH => 'src'
} ;
$tt->process( $ttml, {} ) or die $tt->error ;
===================
src/my_wrapper.html
===================
Content-type: text/html
<html>
<head>
<title>My Page</title>
</head>
<body>
<hr />
[% content %]
<hr />
</body>
</html>
=================
src/index.en.ttml
=================
[% WRAPPER my_wrapper.html %]
<h1 style="color: red">Hello!</h1>
[% END %]
=================
src/index.fr.ttml
=================
[% WRAPPER my_wrapper.html %]
<h1 style="color: blue">Bonjour!</h1>
[% END %]
I hope that's clear enough; if not, feel free to ask and I will explain.
Thanks,
Doug Gorley | [EMAIL PROTECTED]
I would like to create a multilanguaged site with template toolkit.
lets say i have 2 pages for each lang (i have a lot more, but thats for
example)
index.html and about.html
in each page there is an if-else include, to load the different content
in the different languages.
lets say i want two languages in my site, i will have to create
index.it.html, about.it.html, index.en.tml, about.en.html and each time
i create one file i should change the value passed in the [% INCLUDE %]
and i should change the name to fit my structure.
i was wondering if there is a way to create these 4 pages from 2
templates (index.ttml and about.ttml) in a similar way with a command or
a script that works like this and working similarly to ttree but
accepting this option:
create_pages("src/", "en"); that gets index.ttml and about.ttml from
src/, includes the english content and generates index.en.html and
about.en.html
sorry for my bad english and exposition ;)
is there anyway to do this?
thank you in advance.
--
flevour <[EMAIL PROTECTED]>
francesco levorato
http://flevour.mine.nu/
GPG fingerprint:
BB5C 27D8 EFCE A530 7AD5 057A 219D B539 5F4B 644B