[Chameleon] Can't use setcookie

Abe Gillespie abe.gillespie at gmail.com
Thu Jul 28 15:30:44 EDT 2005


Thanks for the help.  This is what I did in the index.phtml file:

ob_start();
$oApp->CWCExecute(CHAMELEON_PATH."/widgets/MapsOnline");
ob_end_flush();

All other setup code can be outside the ob_* stuff.  After reading
some user comments in the PHP docs and experiencing it for myself ...
this had the side effect of actually increasing the speed of this
site.  Wow.

-Abe

On 7/28/05, Abe Gillespie <abe.gillespie at gmail.com> wrote:
> I'm not terribly familiar with cookies either.  I just know it's set
> with the header information, therefore if the header has already been
> sent (i.e. output to the client has already started) then the call to
> setcookie fails.  You can't modify something that has already been
> sent.  In short, you need to call setcookie before headers are sent.
> 
> I'll give it a look.  Thanks.
> 
> -Abe
> 
> On 7/28/05, Bart van den Eijnden <BEN at syncera-itsolutions.nl> wrote:
> > Hi Abe,
> >
> > I am not super familiar with this, is a cookie normally set after the headers are sent, or before?
> >
> > You could try using the ob_start stuff which I posted:
> >
> > http://lists.maptools.org/pipermail/chameleon/2005-July/002632.html
> >
> > it does put the output in a buffer which you can modify with a callback function (see the php ob_start docs).
> >
> > Don't know if this will help for your specific case though.
> >
> > Best regards,
> > Bart
> >
> > Bart van den Eijnden
> > Syncera IT Solutions
> > Postbus 270
> > 2600 AG  DELFT
> >
> > tel.nr.: 015-7512436
> > email: BEN at Syncera-ITSolutions.nl
> > >>> Abe Gillespie <abe.gillespie at gmail.com> 07/28/05 20:43 PM >>>
> > I'm trying to use setcookie() within a custom widget but I cannot due
> > to output already being sent to the client:
> >
> > Cannot modify header information - headers already sent by (output
> > started at /var/www/chameleon-2.0.1/htdocs/widgets/RulerResult/RulerResult.widget.php:102)
> >
> > Unfortunately this isn't just a case of modifying
> > RulerResult.widget.php ... there isn't actually any code at line 102
> > (the last line of code is 100).  So the error message is misleading.
> >
> > Is there a Chameleon API item that I can use to buffer output ... can
> > I use a direct PHP call?  Any thoughts?
> >
> > Thanks.
> > -Abe
> >
> > _______________________________________________
> > Chameleon mailing list
> > Chameleon at lists.maptools.org
> > http://lists.maptools.org/mailman/listinfo/chameleon
> >
> >
>



More information about the Chameleon mailing list