Re: [Templates] CHanging content type under Apache::Template.

[prev] [thread] [next] [Date index for 2004/04/26]

From: =?ISO-8859-1?Q?Lo=EFc?= Paillotin
Subject: Re: [Templates] CHanging content type under Apache::Template.
Date: 13:47 on 26 Apr 2004

> 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

[Templates] CHanging content type under Apache::Template.
=?ISO-8859-1?Q?Lo=EFc?= Paillotin 13:09 on 26 Apr 2004

Re: [Templates] CHanging content type under Apache::Template.
=?ISO-8859-1?Q?Lo=EFc?= Paillotin 13:47 on 26 Apr 2004

Re: [Templates] CHanging content type under Apache::Template.
=?ISO-8859-1?Q?Lo=EFc?= Paillotin 07:52 on 27 Apr 2004

Re: [Templates] CHanging content type under Apache::Template.
merlyn (Randal L. Schwartz) 15:22 on 26 Apr 2004

[Templates] Re: Apache::Template 0.09 (was: changing content type)
merlyn (Randal L. Schwartz) 13:32 on 27 Apr 2004

Re: [Templates] Apache::Template 0.09
Geoffrey Young 21:38 on 27 Apr 2004

Re: [Templates] Apache::Template 0.09
merlyn (Randal L. Schwartz) 21:50 on 27 Apr 2004

Re: [Templates] Apache::Template 0.09
Geoffrey Young 22:07 on 27 Apr 2004

Generated at 08:56 on 15 Mar 2005 by mariachi v0.52