Unless you have full whitespace eating turned on, your template is emiting returns before the header... that might be a problem. Maybe turn on the TRIM option or PRE_CHOMP and POST_CHOMP?
--mark mills Xodiax Engineering P.S. (warning, advice given on three hours sleep...) > -----Original Message----- > From: Michael Cipriano [mailto:[EMAIL PROTECTED] > Sent: Wednesday, December 31, 2003 2:29 PM > To: Template Toolkit > Subject: [Templates] Sending different headers > > > I am having a slight problem trying to send a custom header > from within > a > [% PERL %] directive. Here is my setup. > > I have a script called site.pl which takes in arguments and > will display > a number of different templated depending on the arguments > passed to it > (?page=intro, etc). On some occasions, I want to send a specialized > header such as > > Content-disposition: attachment; filename=results.txt > Content-transfer-encoding: binary > Content-Type: application/txt; name="results.txt" > > Now the way I am handling this is on certain url's I am > passing another > variable (?noheader=T), and if that variable is there, it > will not print > out the header line, and on the templates that are handling > these types > of pages I am including the following in the template > > [% IF noheader == 'F' %] > <html> ..... etc etc > [ % END %] > [% INCLUDE perlcodefile %] > [% IF noheader == 'F' %] > etc etc </html> > [ % END %] > > Now inside of the perlcodefile I have a script that will print out the > special header if needed (it is not always needed, such as > when noheader > = F). > > It seems that the header gets printed out when the template file is > being processed I guess, though am not sure. I made sure that > there were > no spaces or lines before the include of the perlcodefile. > What ends up > happening is that the page returned will just have the specialized > header showing as plain text on the top of the page. > > Is there anyway of doing this the way I want, or do I have to take a > different approach? > > Thanks > > Michael Cipriano ([EMAIL PROTECTED]) > Research Assistant I, Global Infectious Diseases > Josephine Bay Paul Center, Marine Biological Laboratory > > > > > _______________________________________________ > templates mailing list > [EMAIL PROTECTED] > http://lists.template-toolkit.org/mailman/listinfo/templates > _______________________________________________ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
