10 Easy Steps to set up Model-Glue 2: Unity on a Shared Host

Once I had it working, I was astounded by the simplicity. The only pre-requisite is that your server is running ColdFusion 8 or above. Here are the steps:

Note that the following steps assume your site is already created

  1. Download ColdSpring.
  2. Unzip ColdSpring, rename the unzipped folder to “coldspring” and copy it into your site root.
  3. Download Model-Glue.
  4. Unzip the Model-Glue archive into a temp folder.
  5. Copy the Model-Glue folder into your site root.
  6. Copy the contents of the /modelglueapplicationtemplate directory to your site root. Do NOT copy the folder itself.
  7. From your site root, open /config/ColdSpring.xml and delete the two occurrences of “/modelglueapplicationtemplate” on lines 12 and 13. This should result in your viewMappings being “/views” and your generatedViewMapping being “/views/generated”
  8. From your site root, open /config/ModelGlue.xml and delete “modelglueapplicationtemplate.” from line 3 making it “controller.Controller” instead of “modelglueapplicationtemplate.controller.Controller”.
  9. Delete Application.cfm from your site root and replace it with the Application.cfc in this zip file.
  10. Open Application.cfc and change the application name from yourAppNameHere to your application name. If you don’t know what to use, use your domain minus the dot, i.e., “myDomainCOM”.

Providing your server is running ColdFusion 8 or above, you should now have a working Model-Glue site! To test it, open the site in your browser and you should see a message stating “Model-Glue is up and running!”


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!