PDA

View Full Version : How To Create Per-Application Mappings for your ColdFusion Site



jakeh
May 24th, 2010, 05:42 PM
In ColdFusion 8 and above, it is possible to create per-application mappings through your site's Application.cfc file. If you have yet to implement an Application.cfc file, please see Raymond Camden's tutorial on setting this up: Application.cfc Methods and Example Uses (http://www.coldfusionjedi.com/index.cfm/2007/11/9/Applicationcfc-Methods-and-Example-Uses)

Once you have your Application.cfc created, you will insert the following line:

<cfset this.mappings["/test"]="d:\home\yourdomainname.com\wwwroot\test">

On your site though, you would change "/test" to the name of your mapping. IMPORTANT: You need to include the forward slash before the name of your mapping. You would also change "d:\home\yourdomainname.com\wwwroot\test" to the full physical path to the folder you wish to map. Note: The physical path to your FTP root is listed in the "Website Settings" of your Helm account.

To call a template named "testing.cfm" in the "test" directory we just mapped, you would use this line:

<cfinclude template="/test/testing.cfm">

If you also wish to create custom tag paths, please see this post: Creating Your Own Custom Tag Paths (http://forum.hostek.com/showthread.php?298-Creating-Your-Own-Custom-Tag-Paths)


References:

Blog of Fusion: ColdFusion 8 Per App Settings - Mappings (http://www.blogoffusion.com/032508-coldfusion-8-per-app-settings--mappings.cfm)
ColdFusion LiveDocs: Per Application Settings (http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=appFramework_04.html)