View comments | RSS feed
Contents > CFML Reference > ColdFusion Functions > GetCurrentTemplatePath PreviousNext

GetCurrentTemplatePath

Gets the path of the page that calls this function.

The absolute path of the page that contains the call to this function, as a string.

System functions

GetCurrentTemplatePath()

GetBaseTemplatePath, FileExists, ExpandPath

If the function call is made from a page included with a cfinclude tag, this function returns the page path of an included page. Contrast this with the GetBaseTemplatePath function, which returns the path of the top-level page, even if it is called from an included page.

<!--- This example uses GetCurrentTemplatePath to show the 
template path of the current page ---> <h3>GetCurrentTemplatePath Example</h3> <p>The template path of the current page is: <cfoutput>#GetCurrentTemplatePath()#</cfoutput>

Contents > CFML Reference > ColdFusion Functions > GetCurrentTemplatePath PreviousNext

ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

Comments


jamie jackson said on Apr 12, 2005 at 2:13 PM :
There is either a bug in the documentation, or a bug in the function itself. If you have a UDF (defined in <cfscript>), which calls getCurrentTemplatePath(), then getCurrentTemplatePath() will return the path of the page that called the UDF, not the path of the page that calls getCurrentTemplatePath().

I am told that this odd behavior doesn't exist when the UDF is defined in <cffunction>.

I can't imagine why the two different UDFs would behave this way, but if it's deliberate, please update the documentation with this information. If it's a bug, then I'll be happy to report it.

Please advise.

Thanks,
Jamie
jamie jackson said on Apr 13, 2005 at 10:25 AM :
Well it appears that the CF community has capitalized on the differing behaviour, so bringing the two contexts into accord would break a lot of code.
Maybe some documentation notes would suffice.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functi91.htm