Using CFAjaxProxy in a Shared Hosting Environment

As I mentioned in my last post (Drag and Drop Sorting with CFAjaxProxy and Script.aculo.us) I’ve started to use CFAjaxProxy. It’s been very easy to integrate and I had no problems at all on my local machine. However, after posting my work to a live site my AJAX functionality ceased working.

Thanks to Firebug, I was able to track down the issue pretty quickly. The cfajax.js and cfmessage.js libraries were failing to load. These files are located in subfolders under the CFIDE folder.

For those unfamiliar with the CFIDE folder, it contains central and core coldfusion files, custom tags, libraries and the ColdFusion administrator. The reason I wasn’t having the problem locally was because I wasn’t in a shared hosting environment so CFIDE was right where ColdFusion expected it to be.

In a shared hosting environment, however, ColdFusion looks for CFIDE in the root of the current domain. So, rather than looking in the web server root, it looks in the domain root. For example, if the site I’m working on is mysite.com, ColdFusion will look for CIDE in http://www.mysite.com/CFIDE/.

While I could make a virtual directory mapping to the existing CFIDE folder, I didn’t want to expose the ColdFusion Administrator. Instead, I created a new CFIDE folder and copied only the SCRIPTS subfolder into it. I then created a CFIDE virtual directory within the domain which pointed to the new CFIDE folder.

I know many developers have experienced a similar issue with CFFORM, however, that issue can be surmounted with the use of the scriptsrc parameter which isn’t available for CFAjaxProxy.

Admittedly, this solution feels a bit lame, but I’m unaware of any other way around it. If you know of a better way, please leave a comment!

-rG

Drag and Drop Sorting with CFAjaxProxy and Script.aculo.us

I made a video player recently containing a list of videos. My client requested the ability to put them in a custom order. It didn’t take much research to find the functionality in the Script.aculo.us library. The question was, how do I implement it with ColdFusion?

I knew I would need AJAX functionality and, up to this point, I had always used Rob Gonda’s AjaxCFC. With the release of ColdFusion 8, however, Adobe introduced CFAjaxProxy. I’d been looking for an opportunity to give it a try and this turned out to be a perfect fit.

Jake Munson of Yacoblog posted a great introduction to using CFAjaxProxy. Simple and straight to the point. I had it working in no time.

My next stop was a post by Mohammed Irfaan over at the Lynch Consulting Blog which discusses a technique for using ColdFusion to update an underlying table after using Script.aculo.us’s Drag and Drop functionality.

Here’s how I put it all together:
Continue reading “Drag and Drop Sorting with CFAjaxProxy and Script.aculo.us”