views:

194

answers:

4

I have this nice big Dev Kit written in PHP, but the application I'm currently developing is in CFML.

In an attempt to avoid rewriting the PHP, I'm going to try to just wrap the PHP in CF <script> tags and call the PHP functions when I need them.

Does anyone have any idea how to call one of those PHP functions inline in CF?

+2  A: 

You can't. It's a whole other app engine. You could use CFHTTP to call a PHP page - but it's a bit overkill. You can look at Sean's solution here:

http://corfield.org/entry/ColdFusion_8_running_PHP

CF Jedi Master
+4  A: 

There's no built-in way to do this, but using CFGroovy (which allows you to inline any Java Scripting API-compliant language implementation) and Quercus (a PHP implementation in Java), you may be able to pull off what you want/

CFGroovy: http://www.barneyb.com/barneyblog/projects/cfgroovy2/

Quercus: http://www.caucho.com/resin-3.0/quercus/

A simple example including source code: http://www.barneyb.com/cfgroovy2/

Edward M Smith
+1  A: 

Edward M. Smith is right. You may be able to mix PHP and CFML by using Resin as your JVM. While I have not done so, I do believe it is possible to have Resin interpret your PHP code from within the same context as a CFML (ColdFusion) Web site.

A .cfm/.cfc could not contain any PHP and a .php file could not contain any CFML/CFScript; however, those files could live side by side within your www.something.com domain.

Resin http://www.caucho.com/ is a Web Server/PHP Interpreter that is very fast and written in Java. It is the bundled JVM for the open source CFML project Railo.

Hope this helps.

Aaron Greenlee
A: 

You can pass data back and forth by having php/coldfusion store/retrieve client array's or variables.

One other choice is to force coldfusion to parse through .php files, for any coldfusion inside there. How it would handle the mixture of coldfusion and php, I am not sure...

crosenblum