FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Output buffering in included file
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Output buffering in included file [message #178724 is a reply to message #178722] Wed, 25 July 2012 05:33 Go to previous messageGo to previous message
J.O. Aho is currently offline  J.O. Aho
Messages: 194
Registered: September 2010
Karma:
Senior Member
Dani wrote:
> Hello everybody,
> instead of using (e.g. in index.php)
>
> <?php
> ob_start();
> include('included-file.php');
> $output = ob_get_clean();
> echo $output;
> ?>
>
> to store the output buffer into a variable, can I use in included-file.php
>
> <?php
> ob_start();
> include('included-file.php');
> ?>

You can do all of it in the include file, but everything which is before/after
the include file will not be in the buffer.

Remember also that pages which takes long time to generate, may cause time
outs when using buffers. IMHO don't use buffers if you really don't have a
good reason to use them, just see to that you have proper error handling and
your functions returns the generated content instead of using echo/print.
Those times you have a area where you know there will be issues of long
execution time, just see to generate some output once in a while.



--

//Aho
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Web page design
Next Topic: ncurses on windows
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Sep 19 16:25:11 GMT 2024

Total time taken to generate the page: 0.04726 seconds