On Thu, Aug 19, 2010 at 6:01 PM, Tristan <sunnrun...@gmail.com> wrote:

> So, I'm have this site where all this code was developed and the logic sits
> in different plugins throughout a template. So, html is output and then
> hits
> one of these plugins. Plugins do some processing and then hit a
> header(location...) redirect.
>
> So, problem is they developed code with these header redirects and now we
> there's too much html being output so we get the buffer errors
>
> Cannot modify header information - headers already sent by (output started
> at
>
> /home/carma/templates_c/carma^0^31^811^%%E2^E22^E22E607D%%carma%3Amenu.php:138)
>
> to fix we have to up the buffer ouput in the php to something really high.
>
> So, as far as I know this is not good coding practice and upping the output
> buffer is really masking the problem.
>
> Is there another way to work around this like another way to do redirects
> that won't cause these buffer probs?
>
> Thanks, T
>

I believe the error is informing you that some content has already been sent
back to the client.  Once any content has been sent back, the headers have
already been set and you can't subsequently call header().

For an easy fix, you should be able to turn on output buffering for the
request and all of the output will be held until the entire page is finished
processing:
http://php.net/manual/en/function.ob-start.php

Alternatively, you can sift through you code looking for any output (even a
single whitespace) that's present before the call to header in  the menu.php
file referenced in your error.

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com

Reply via email to