Posted by Jon Slaughter on 04/28/07 21:16
I have some code that loads up some php/html files and does a few things to
them and ultimately returns an html file with some php code in it. I then
pass that file onto the user by using echo. Of course then the file doesn't
get seen by the user.
Is there any command that essentially executes the code and then echo's it?
something that will take a string like
'<body>blah<?php echo 'Hello'; ?></body>' and actually interpret the php
code?
e.g., doing
echo '<body>blah<?php echo 'Hello'; ?></body>';
does me no good caues the php code isn't interpreted.
Saving it to a file and then redirecting the user to that file so it will be
executed seems like a roundabout way and causes more problems.
essentially I am trying to include php/html files in one another but I need
to do some parsing on them first. I'd rather not do something like
file_get_contents($Page)
parse($Page)
save($Page)
include "$Page"
as it seems uncessary to have to write the page to disk just to include it.
At
http://us2.php.net/include/
"Another way to "include" a PHP file into a variable is to capture the
output by using the Output Control Functions with include(). For example:"
Seems like I might be able to use that to replace when I use
file_get_contents to get the php code to execute?
Thanks,
Jon
[Back to original message]
|