RE: [PHP] Pregenerating Script
| From: | Kevin Stone | Date: | Thu, 31 Jan 2002 18:33:19 +0000 |
| Subject: | RE: [PHP] Pregenerating Script | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-82968@lists.php.net to get a copy of this message | ||
Sound like the perfect job for Output Buffering. I only recently
learned about these functions and they're great! There are four
functions you need to be aware of..
ob_start() Starts output buffering anything going out to the screen is
routed to the buffer.
ob_flush() Outputs the entire buffer.
ob_clean() Cleans the buffer.
ob_get_contents() Setting this to a variable will put the contents of
the buffer into that variable.
What you can do to combine all headers and page elements then
essentially "blit" the whole thing to the screen is this...
ob_start();
header("whatever");
header("whatever");
include("header.html");
include("footer.html");
ob_flush();
Yes I believe it really is that simple. :) Will only work with the
most recent versions of PHP but I hope it helps. Good luck.
--
Kevin Stone
Kevin@helpelf.com
www.helpelf.com
> -----Original Message-----
> From: karthikeyan [mailto:karthikeyan@aspiresys.com]
> Sent: Thursday, January 31, 2002 9:59 AM
> To: php-general@lists.php.net
> Subject: [PHP] Pregenerating Script
>
> Hi Guys,
>
> I want a php script which takes 4 parameters :
>
> - header file
> - body file
> - footer file
> - OUTPUT file
>
> What it should do is combine 1. header, 2. body, and 3. footer and
save
> it as 4. OUTPUT file
>
> How do i do that.
>
> Any help with sampe code will be greatly appreciated.
>
> Regards,
>
> karthikeyan b