|
Posted by d on 10/13/90 11:39
"Albe" <albe@ambientatom.co.za> wrote in message
news:op.s4piaokhth8uo6@equus.up.ac.za...
> On Thu, 09 Feb 2006 10:48:35 +0200, Jasen Betts <jasen@free.net.nz> wrote:
>
>> On 2006-02-08, Fred Paris <nono@nono.invalid> wrote:
>>> 2)
>>> I also have a script, script.php
>>>
>>> 3)
>>> When script.php runs, I want it to run php on template.php, and write
>>> the resulting html output to a file.
>>
>> use "ob_start"(etc...) to capture output and "require" to run the
>> external
>> php script.
>
> There is another way to do it. You can eval() the code inside
> template.php.
>
> <?php
> $fc = file_get_contents("template.php");
> $result = eval(" ?>".$fc."<?php ");
> $fh = fopen("resultfile.html", w);
> fwrite($fh, $result);
> fclose($fh);
> ?>
Using eval() is never the way forward :) If you find eval is your saviour,
you've done something wrong :)
Navigation:
[Reply to this message]
|