tags:

views:

62

answers:

1

We have an existing PHP page (from an earlier project) which could be described as cryptic and ancient. It basically displays a form, catches the input and runs an external application to process the input and then pipes the output to the user.

I would really like not to modify this file any more than is required. Would there be an easy way to just make this file magically work by copying it to some location in the CakePHP's directory and have it receive $POST etc. as usual?

+1  A: 

Given that this is a simple form you described, I would simply move that form to a view, handle the post in a controller (possibly converting cake's POST data to your form's "old format" and "forwarding" it to the old page code). You could then redirect to a result page or just output it in the same view. It could be a simple copy-paste job, but only you know if that's true. But if it is really that simple, a conversion is due ;)

I'm afraid there is no way do just "plug it in" and have it working, or at least I'm not aware of any way to do that.

Unless you're willing to leave that form in your /app/webroot and keep it separate from the rest of your app? Anything placed there should be left alone by cake, so I guess that would work..?

dr Hannibal Lecter
Yeah I too think keeping it in the webroot will leave it alone. But then how to pass POST data from CakePHP to that page? In cake the POST data always goes to the controller, what do you think about sending that data from Controller to this old form as POST data?
Ashok
Sorry about my late reply, didn't see it till now.. Why would you want to redirect your POST data from cake? Can't you use the same old form and leave cake completely out of the picture?
dr Hannibal Lecter