foundeo / cfdocs

Repository for the cfdocs.org site.

Home Page:https://cfdocs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Announcing cfPHP CFML->PHP "engine" (github project)

marcovth opened this issue · comments

Hello ...

I would like to announce my open source automatic Coldfusion CFML -> PHP translator/"engine" project called cfPHP. At the moment it's just in a proof of concept stage with a couple of functional tags, but I think with my setup it will eventually be possible to virtually run CFML pages on PHP servers.

The initial aim is to automatically translate a CFML page 80% correctly, and let the site-owner make 1 or 2 rounds of adjustments to the generated PHP code before exporting it to a final PHP page with the same CFML page name. When a final PHP page is exported, every time a CFML page is called, the CFML code gets ignored, and the final PHP code gets executed as an include instead.

This way (if all will work the way I hope it can work) you will obtain a virtual CFML server. Just 1 or 2 rounds of some PHP editing needed, and the CFML/PHP combination should run "for ever".

I have below screenshots of how that will look like at admin level, with a couple of (still partially) functioning CFML tags.

It will differ from the PHP Smarty project in that you don't have to separate the Smarty code from the PHP code in different (template) files. Any PHP code inside tags will be copied over as is, and the PHP block will be surrounded by tags instead of cfscript tags. So any cfscripts will not be touched at all, the site-owner will have to edit that to PHP by hand if needed.

Also, with cfPHP you will be able to use PHP-style dollar $variables inside CFML code instead of CFML-style pound #variables#. In other words, you can a mix of PHP/CFML code in the same CFML page. You will also be able to use CFML functions in PHP code. I think that should (like Smarty) make PHP coding much simpler with debugged CFML functions and tags basically as PHP-code-blocks.

I am starting here with a CFML "server" layer on top of PHP, but eventually the cfPHP project could also be extended to other HTML-style tag languages as well.

I have been thinking for the last 10 years how a CFML engine based on PHP would be so much faster, cheaper and easier to work with than the Java-based Coldfusion servers out there. I had some Corona-time to kill these past weeks, and I believe it will be possible, at least for some proof of concept tags and functions, but many more can follow.

One of the first problems I came across is that the dot notations in e.g. CF structures is not possible with PHP. Dots are used to concatenate strings, but I think I found a solution that can work. There will surely be a lot of technical details to slug through which most regular CFML will never have to deal with, but the way it looks like now, I will have to be in isolation (for a year) until a vaccine for Corona becomes available anyways. There will be plenty of time to kill for this project.

Feel free to join this project if you like to translate some CFML tags and cffunction equivalents.

https://github.com/marcovth/cfphp

https://www.facebook.com/groups/722672091838069/

In advance, thanks for your reply.

  • Marco.

This code is fully, automatically, translated (in Admin mode) ... After one or two rounds of PHP editing (for these examples that was not needed), in the last window you see the final PHP executed output. I started with database type of CFML tags, because the whole project will not make sense without them. SQlite and MySQL (Northwind test db) is working and was limited tested.

screenshot1
screenshot2

This looks interesting, thanks. I'm going to close this issue however, since it is not really related to cfdocs.