Hi there,
We have a situation where we need to read a php file from another php file, and somehow get the php code within the file we've read to execute (basically, have variables replaced with their values) after we've read it.
Is there a way to do this?
If not, I'm sure we could probably do it via brute force... that is, search the string for all values like <?=$var1?> ... <?=$var2?> ... and replace them with the actual values. What would be the correct syntax for doing this?
Thanks!
How to execute PHP code that's read in?
Moderator: General Moderators
Can't use require/include. Instead using "file"
No. I mean actaully doing a "file" to read in the entire file. We don't want to use require/include, because these pages are executed separately most of the time (ie, http://www.whatever.com/file.php).
There are a few occassions the content of those pages are in an IFRAME, and to create a printer-friendly version, of the IFRAME's content along with the PARENT's content, we need to read the php file and do some special formatting.
The issue is how to replace variables in the file.php with the actual values as it's being parsed by the parent php script.
There are a few occassions the content of those pages are in an IFRAME, and to create a printer-friendly version, of the IFRAME's content along with the PARENT's content, we need to read the php file and do some special formatting.
The issue is how to replace variables in the file.php with the actual values as it's being parsed by the parent php script.
maybe something like http://uk.php.net/variables.variable might work?