Re: HTML and PHP output to PHP variable
| From: | Maris | Date: | Mon, 12 Jul 2004 09:24:32 +0000 |
| Subject: | Re: HTML and PHP output to PHP variable | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-190229@lists.php.net to get a copy of this message | ||
Thanks a lot Miroslav,
will try this construction! :)
"Miroslav Hudak" <php@maniax.sk> wrote in message
news:40F2573E.60007@maniax.sk...
> hello!
>
> use output buffering...
>
> <?php
> ob_start();
> //... your code here
> $_contents = ob_get_contents();
> ob_end_clean();
> ?>
>
> regards,
> m.
>
> Maris wrote:
>
> > Hi!
> >
> > Let's say my index.php consists of the following:
> >
> > <? include("header.inc"); echo "<p>PHP says Hello
> > World</p>"; ?>
> > <p>HTML says Hello World</p>
> > <? //.. some other php code that generates output... ?>
> > ..some other HMTL output..
> >
> > My question is:
> > how can I make the whole index.php generated output put in one PHP
variable?
> > It is also important that it is done from the same index.php file.
> >
> > Thanks,
> > Maris
> >