[Typo3] Cookies at Typo3

Kraft Bernhard kraftb at gmx.net
Thu Apr 28 16:01:00 CEST 2005


Chris Wittmann [SwiftLizard] wrote:

> Warning: Cannot modify header information - headers already sent by 
> (output started at /usr/home/sstahl/public_html/typo3/ 
> typo3_src-3.7.0/typo3/sysext/cms/tslib/index_ts.php:435) in 
> /usr/home/sstahl/public_html/typo3/schuettstahl/fileadmin/lib/session2.inc 
> on line 45

This is no Typo3 error.

The problem lies purely in the protocoll of HTTP.

If you (want to) set a cookie the cookie data get's sent in the HTTP reply header,
which gets sent from the server to the client, in front of (before) the served page.

When you do some output with php "echo" or by simply outputting html from a php file
(every content not in <?php ... ?> will get sent as plain html content)
the headers will get sent before.

So there's no possibilty to set a cookie after some output has been sent. You will have
to find the place where your scripts output data and will have to put that in some variable
instead of using echo ... you can echo it after the set_cookie() statement ...

pherhaps the php functions "ob_start" (Output Buffering STart) might come in handy.


greets,
Bernhard
-- 
Kraft Bernhard
MOKKA Medienagentur <http://www.mokka.at>
T: +43 - 1 - 895 33 33 - 50



More information about the TYPO3-english mailing list