RE: [PHP-GENERAL] evaluating PHP source to a file.
| From: | indrek siitan | Date: | Thu, 22 Jun 2000 04:30:19 +0000 |
| Subject: | RE: [PHP-GENERAL] evaluating PHP source to a file. | ||
| References: | 1 | Groups: | php.dev php.general |
| Request: | Send a blank email to php-dev+get-21943@lists.php.net to get a copy of this message | ||
Hi,
>> --> $content=eval($template);
> What's a sample template, and what's coming out on the browser
> and what's being stored in $content. Because I would expect
> this to "work" if what you describe is what you really want.
no, it's not working that way. eval() always writes it's output
to the current document and there seems to be no way of catching
it into the $content.
I tried playing around by opening special filehandlers (like doing
$fd=open("php://stdout") and trying to see if I can catch the output
through that, but nothing helped.
then I decided the only way to go was to write down the template to
a file on the disk and do exec("php -q template.php > output.html").
but it didn't work either - just as the template or content went a
little more complex (db connect / couple of queries) the output.html
started containing just the headers (even -q means NO HEADERS). the
same thing executed from the shell worked just fine. I even tried
writing down a shell script and then executing it by exec() - still
the same. the same script when run from the shell command line works
like a charm.
I currently had to build the system especially ugly way - I write
down the shell script and then a flag file from the PHP script, and
then have a every-2-minutes cron job what checks the presence of
the flag file and if it exists, executes the shell script..
PS. I'm still not subscribed to the lists, so please CC: an answer
to my e-mail address. Thanks.
Rgds,
Tfr
--==< tfr@cafe.ee >==< http://tfr.cafe.ee/ >==<
+1-504-4467425 >==--