How do I get the directory for the current template?
Use the two ColdFusion functions getCurrentTemplatePath() and getDirectoryFromPath().
<cfset currentPath = getCurrentTemplatePath()> <cfset currentDirectory = getDirectoryFromPath(currentPath)> <cfoutput>This directory is #currentDirectory#</cfoutput>
The function, getCurrentTemplatePath(), will return the full path of the current template. By path we mean the directory and file name. The function, getDirectoryFromPath(), will then get just the directory from the path.
This question was written by Stan Winchester
It was last updated on January 26, 2006.