Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call a php function within <script> tag from coldfusion 9

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?

like image 994
Jimmy Avatar asked Dec 29 '22 13:12

Jimmy


2 Answers

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/

like image 175
Edward M Smith Avatar answered Dec 31 '22 02:12

Edward M Smith


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

like image 35
Raymond Camden Avatar answered Dec 31 '22 02:12

Raymond Camden