[thelist] configuring other extensions to run php pages?

Carl J Meyer cjmeyer at npcc.net
Thu Dec 12 11:39:19 CST 2002


Tom,

On solution which I've used (don't know if it is appropriate to your
needs in this situation) is to read in a file and then run it through
eval(), like so:

$file = implode('', file('myfile.tom'));
eval('?> ' . $file . '<?php ');

The closing and opening PHP tags are necessary so that eval() enters the
file in "html" mode, not "php" mode, until it encounters a <?php tag.
eval() won't return anything (unless you have a return() statement in
the .tom file), but all html from the .tom file, and all php output,
will go straight to the browser.  If you want to capture all this output
and do something else with it, you'd need to use the output buffering
functions, like so:

$contents = implode('', file('myfile.tom'));
ob_start();
eval('?> ' . $file . '<?php ');
$parsedContents = ob_get_contents();
ob_end_clean();

Setting up an .htaccess so that .tom files are evaluated as php, and
then redirecting the browser to the generated .tom file, may be a better
solution for your situation, just thought I'd pass on this option as
well.

Carl

On Thu, 2002-12-12 at 06:32, Tom Dell'Aringa wrote:
> Yes, What Hershel said above, amend my question with that as I forgot
> to mention that...they are dynamically generated. In fact, that is
> exactly what we would need - to pipe the generated .tom page through
> php - is that possible?





More information about the thelist mailing list