Recently, I have been working with reading of text files and xml files. To do this you can use the Coldfusion cffile function.
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.
Code Example:
<span style="color: #800000;"><cfset currentPath = <a href="http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=functions_e-g_35.html#1104906">getCurrentTemplatePath()</a>></span>
<span style="color: #800000;"><cfset currentDirectory = getDirectoryFromPath(currentPath)></span>
<span style="color: #800000;">
<a href="http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_m-o_16.html#1101659"><cfoutput></a></span>This directory is #currentDirectory#<span style="color: #800000;"><a href="http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_m-o_16.html#1101659"></cfoutput></a>
</span>
[ad]
Leave a Reply