Randal L. Schwartz wrote: > I had a similar problem... so I created this:
[...snipola...] > Note the comment... Apache::Template isn't pluggable enough, so I had > to cut-n-paste (evil) the entire headers method just to disable the setting > of content-type. :) Version 0.09 of Apache::Template is now on its way to CPAN. Available right here, right now: http://wardley.org/perl/Apache-Template-0.09.tar.gz This adds 'type' to the TT2Headers options: TT2Headers type length etag Note that if you don't specify any TT2Headers option then you get just 'type' by default (same as 0.08 and before). But if you are currently using TT2Headers then you will now need to explicitly add 'type' if you want the Content-Type sent (or leave it out if you don't). TT2Headers length etag # v0.08 and earlier - 'type' implicit TT2Headers type length etag # v0.09 - must add 'type' explicitly Or you can set it to 'none' and, unsurprisingly, you get none of the headers. TT2Headers none There is also the TT2ContentType option to set a different Content-Type to the default of 'text/html'. TT2ContentType text/xml > But now, from within my template code, I can say things like: > > [% > IF content_type() == "text/html"; > ... > END; > %] I didn't add anything to do this explicitly because you can currently make the request accessible and do it through that: TT2Params request And then in the template: [% IF request.content_type == 'text/html'; ... END %] Not quite as succinct, but it does the job and saves us from having to having to add anything to Apache::Template that can't easily be added in a subclass. Thanks for the code and ideas! Cheers A _______________________________________________ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
