Re: [SMARTY] How to change HTTP headers
| From: | Ivo Jansch | Date: | Sat, 24 Sep 2005 10:31:00 +0000 |
| Subject: | Re: [SMARTY] How to change HTTP headers | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-13055@lists.php.net to get a copy of this message | ||
Hi,
thomas Armstrong wrote:
> But when analyzing my HTTP headers, I get:
> --------
> * Content-Type = text/html; charset=ISO-8859-1
> --------
> What am I doing wrong? Thank you very much.
The problem is that your function is executed only during the initial
rendering of the page. When the page is cached, your function is no
longer executed, and the header no longer output.
If you want to change the headers, it's better not to put them in your
template, but before your call to smarty->fetch, like so:
<?php
....
header("Content-type: text/html; charset=utf-8");
$smarty->display("index.tpl");
?>
There's not much reason to put the header inside the template, neither
from a template designer perspective nor functionality wise, I think.
Greetings,
Ivo