User Guide Cancel

GetCurrentTemplatePath

 

Note:

You can find the CFFiddle demo of this function and other file functions as part of a project that is shared with you.

Click the button below to launch CFFiddle.

To copy the project in your workspace in CFFiddle, follow the steps below:

  1. Log in with your Gmail or Facebook credentials.
  2. Navigate to the project in the left pane.
  3. Once you make some changes in any cfm in the project, a pop up displays asking you to save the project.
  4. Give the project a suitable name and click Save.
  5. Create a folder named dir1 and upload a text file, myfile.txt.

Description

Gets the path of the page that calls this function.

Returns

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

Category

System functions

Function syntax

GetCurrentTemplatePath()

See also

GetBaseTemplatePath, GetDirectoryFromPathFileExists, ExpandPath

Usage

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.

Example

<!--- 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>

 
<p>The directory containing the current template is:
<cfoutput>#GetDirectoryFromPath(GetCurrentTemplatePath())#</cfoutput>

 

Get help faster and easier

New user?