Executing PHP and ERB one after the other or How I tried to

I’m having fun and games trying to integrate KTML (a PHP based in-
browser HTML editor) with my Rail application (a CMS). Here’s how I’ve
managed to make most of it work so far:

I have my Rails ERB view that constructs the page and the text field
that will later be turned into the KTML editor. In the view is a
Prototype ajax Update Page call to a file called generate.php.
Generate is a file that has all the PHP setup code in it. The results
of the PHP execution is some Javascript that gets returned to the
browser and inserted into a DIV and executed. Our Apache/Mongrel
Cluster also has PHP instaled (in Apache) so this works well. The PHP
executes and sends back the JS.

Everything in the KTML editor works well except for an image insertion
dialogue box that opens as a popup. KTML complains that the session
has become corrupt (the KTML people washed their hands of this problem
because it’s not a standard use, but did say that the PHPSESSIONID
cookie is probably getting corrupted or something like that). If
someone knows how to make php and rails cookies play nice together I’d
be keen to hear from you about it. Otherwise…

An alternative to all of this would be if I could get the view to be
interpreted by rails (I.e. browser sends request to apache, apache
passes it to rails) then have apache also send the result that just
came back from rails onto PHP so that it can execute the PHP tags, PHP
would finally send it back to apache, then back to the browser. :slight_smile:
People laugh when I suggest this but if it could work that would be
excellent. All you’d have to do is use both PHP and ERB tags in the
view and they’d all be interpreted.

Anywho, I saw PHP::Ruby but that didn’t have any links to download it
so I presume it’s either a joke or someone doesn’t update their site
properly :slight_smile:

Any help whatsoever would be greatly appreciated :slight_smile:

Brendon