I think I just discovered my favorite block of code ever. As such, this is a post so that I remember how to do this when I need to do it again, your may not be so impressed.
I was trying to figure out a terse, reusable way of making sure that my application root was mapped to my application name, and that my customtags folder be mapped as a custom tag folder. It had to work with inherited sub application.cfc's and deal with the fact that my application might not be in the root. I came up with this:
<cfset this.name = "APPNAME" />
<cfset this.mappings["/#this.name#"] = getDirectoryFromPath(getCurrentTemplatePath()) />
<cfset This.customtagpaths = "#getDirectoryFromPath(getCurrentTemplatePath())#\customtags\"/>
2 response s so far ↓
1 Raymond Camden // Jun 26, 2008 at 5:51 PM
2 Terrence Ryan // Jun 26, 2008 at 6:08 PM
Leave a Comment