Re: output buffering
| From: | Plutarck | Date: | Fri, 06 Apr 2001 01:57:05 +0000 |
| Subject: | Re: output buffering | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-47375@lists.php.net to get a copy of this message | ||
I know what you mean. Until I decided to kill all but one single echo/print
call, which is in a function I call at the bottom of the script, I often ran
into problems where I needed to echo something at the top of a really really
long control loop, but nested deep within it I had to set a cookie or use a
redirect.
Which is why I killed all my echo/print calls in favor of a single function
which I include at the bottom of my script ;)
--
Plutarck
Should be working on something...
...but forgot what it was.
"Christian Dechery" <lemming@vento.com.br> wrote in message
news:5.0.0.25.2.20010405225317.02404cd0@pop-gw.vento.com.br...
> At 00:26 5/4/2001 -0500, Plutarck wrote:
> >http://www.php.net/manual/en/ref.outcontrol.php
> >
> >If you want to use output buffering you must use the ob_* family of
> >functions.
> >
> >In any script where you want it used you _must_ use it explicitly, or so
do
> >in an included file. Unless you can change the php.ini, there is no way
to
> >force all pages to use output buffering. I don't reccommend you do such a
> >thing anyway.
> >
> >If you aren't using output compression all it does is allow bad
programming
> >practices. One exception is for hosting companies that want to force ads
to
> >be displayed on the page with the auto_prepend type settings.
> >
> >
> >Output buffering should only be used if you have a specific reason for
doing
> >so. Kind of like all PHP functions :)
> >
> >It doesn't cost much in performance except when a script pumps out a very
> >large amount of data. If you want to print a 10mb text file to the
browser
> >it is a considerably _BAD_ idea to force PHP to buffer that all up into
one
> >chunk before puking it out.
> >
> >
> >But, enter the gz_handler functions. If you want to compress your output,
> >then you have a reason for using output buffering. The cost in
performance
> >varies widely, but if your server is already under a considerable load
you
> >probably shouldn't use it.
> >
> >But it's very cool to use if you have the extra processor power, but wait
> >for 4.0.5 to do it. Many people complain about memory leaks and
sub-standard
> >output buffering functions. It's supposed to all be fixed in the new
> >version, so feel free to play around with it :)
> >
> >Still, it's better to be able to set it only in the places you want it
run
> >rather than making all output use it.
>
> exactly... I don't want to set this option to an entire site just because
> of one little script I'm having trouble setting a header() or
> setcookie()... and I wanna use them in the middle of the output...
> something like ASP's <% response.flush=true %>, it can be set anywhere u
> want...
> but of course... the best way is to code right and not to mess with
headers
> once the output has started... but sometimes I wish I could, u know? It
> would really make somethings a lot simpler...
> ____________________________
> . Christian Dechery (lemming)
> . http://www.tanamesa.com.br
> . Gaita-L Owner / Web Developer
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>