eval results to string?
| From: | Julian Wood | Date: | Wed, 11 Oct 2000 03:15:19 +0000 |
| Subject: | eval results to string? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-19481@lists.php.net to get a copy of this message | ||
I've seen this question asked before, but I can't find any answers. Is there
any way to parse a php file into a variable? The solution would seem to lie
with eval(), but it doesn't work quite right.
I have a file with perfectly reasonable php code in it (full of php tags and
html - call it core.php). The php file that is called by the web browser
(called wrapper.php) contains lots of post variables - these are needed and
used by core.php. So just a call to eval right? Well eval evaluates it
properly, but also insists on dumping it to stdout, while neglecting to
place it in the variable. Anyone found a way to do this?
BTW, what I'm trying to do is take some form data (it's several big,
complex, forms) and email someone an html version of the form with the
answers filled out. It's so close, but it seems to be hung up on this
problem. The form itself is in a separate file, with php that evaluates to
nothing if no post vars are present, but fills in if the vars happen to be
there. This seems like an elegant way to do it (I can change the form and
it's embedded php around easily and nothing breaks), but it doesn't work.
The only other alternative that I can see is to do search and replaces
throughout the form from wrapper.php, but this is a very hard coded solution
(changes in the form require changes in wrapper.php). Is there no way to get
the results of eval() to go anywhere (ie a file or a variable) other than
stdout??
Thanks for any insight,
Julian
--
Julian Wood
Learning Technologies and Digital Media
University of Calgary