Re: [SMARTY] Smarty together with phpOpenTracker
| From: | Mark Rogers | Date: | Fri, 01 Apr 2005 13:55:39 +0000 |
| Subject: | Re: [SMARTY] Smarty together with phpOpenTracker | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-12383@lists.php.net to get a copy of this message | ||
Nick Clarke writes:
> Cannot modify header information - headers already
> sent by (output started at
> Smarty_Template.class.php:23) (Error Code: 2) File:
> (phpOpenTracker-1.5.0rc2/phpOpenTracker/LoggingEngine.php)
> Line: (115)
>
> Which I guess means that they both are of course
> sending header information!
No; you can send as many headers as you like. The problem is that they have
to be sent before the document. That is, the "header" functions have to be
called before any output is generated.
The message is telling you that the header code at
phpOpenTracker-1.5.0rc2/phpOpenTracker/LoggingEngine.php line 115 cannot run
because the code at Smarty_Template.class.php:23 previously sent output.
The fix is to either reorganise your code (likely tricky in your case), or
to tell PHP to buffer your output until all processing is complete, allowing
you to use header() calls anywhere you like.
To do the latter, simply put
ob_start();
(ob = "output buffering") somewhere near the top of your PHP file, before
any output gets generated. Lookup ob_start in the PHP help for more
information; it does a lot more than the brief description above.
Mark Rogers,
More Solutions Ltd