RE: [SMARTY] Output buffering?
| From: | Hinrich Donner | Date: | Tue, 04 Mar 2003 19:19:49 +0000 |
| Subject: | RE: [SMARTY] Output buffering? | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8402@lists.php.net to get a copy of this message | ||
Hi!
> I have always been wondering, and this is maybe the exact moment to ask:
> why and in what cases would you do output buffering?
There are some reasons.
1. Most important is the fact that I can use setcookie() and header()
without taking care on the useage of any echo() or print() before.
2. If I received the complete output buffer I also know its size. I can
set up some more HTTP-Headers to speed up the transfer.
3. I am able to modify the output before it is sent. Eg. change href
destinations to something else. This can be important if you want to use
the Apache feature RewriteEngine or if you want to send the result as mail
(in this case you just have to grap the images and put them with the
result to a MIME mail).
4. Smarty generates warnings. In some case, it is difficult to find them
(e.g. if they are hidden in links, alt-properties or comments). If I have
the buffer, I can find them and add a list to the display (debugging
purpose).
5. I can use a different compression, if a client accept this. Or enable a
translation service.
Finally, I am the programmer. It sounds sensefull to me, if I have the
control on the output, not the program.