Re: [Templates] CHanging content type under Apache::Template.
[prev]
[thread]
[next]
[Date index for 2004/04/26]
> Subclass Template::Service::Apache and provide your own header() method=
.
> There's not a lot to it, other than sending the content type and some=20
> extra headers.
>=20
> Then use the following directive in the httpd.conf to invoke your new=20
> service module:
>=20
> TT2ServiceModule Your::Service::Module
>=20
> Alternately, if you're feeling adventurous, you could figure out how
> to add the TT2ContentType configuration directive and then hack on=20
> the regular Template::Service::Apache::header() method to make this a
> configurable option.
>=20
> HTH
> A
Ooops posting this back to the list:
Thanx i figured that out just before your reply.=20
I just made a new Template::Service::Apache module with the following=20
headers() sub:=20
sub headers {
my ($self, $r, $template, $content) =3D @_;
my $headers =3D $self->{ SERVICE_HEADERS };
my $all =3D $headers->{ all };
my $ct =3D $r->dir_config("TT2CustomHeader") ?
$r->dir_config("TT2CustomHeader") : "text/html";
$r->content_type($ct);
$r->headers_out->add('Last-Modified' =3D>
ht_time($template->modtime()))
if $all or $headers->{ modified } and $template;
$r->headers_out->add('Content-Length' =3D> length $$content)
if $all or $headers->{ length };
$r->headers_out->add('E-tag' =3D> sprintf q{"%s"}, md5_hex($$content)=
)
if $all or $headers->{ etag };
$r->send_http_header;
}
And i'm just adding a:=20
PerlSetVar TT2CustomHeader=20
to my configuration.=20
Not as clean as adding a configuration option but I don't feel THAT
adventurous today ;-).=20
Thak you very much for the swift reply,=20
Loic.=20
>=20
>=20
> _______________________________________________
> templates mailing list
> templates@xxxxxxxxxxxxxxxx.xxx
> http://lists.template-toolkit.org/mailman/listinfo/templates
--=20
Lo=EFc.
_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates