Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filename of Current Template 1

Status
Not open for further replies.

sevex

Programmer
Joined
Sep 18, 2001
Messages
74
Location
CA
Does coldfusion have a function that returns simply the filename (not path) of the currently executing template?

I've been looking through the manual and can't find such a thing.
 
Just use.. #cgi.script_name# and use regex to pull out everything before the last "/"..

I can get you the code if you want it.
 
#cgi.script_name# will only work if there is only one cfm file being executed... but if there are <CFTAGS> or <CFMODULE/CFINCLUDE> then using #cgi.script_name# won't work on the included files. Try using the function GetCurrentTemplatePath()

<CFOUTPUT>
[COLOR=666666]<!--- Full Path Name of current file --->[/color]
#GetCurrentTemplatePath()#[COLOR=000080]<BR>[/color]
[COLOR=666666]<!--- Treat the full path as a list with &quot;\&quot; as the
deliminator, and get the last item in the list for
the file name --->
[/color]

#ListLast(GetCurrentTemplatePath(), &quot;\&quot;)#
</CFOUTPUT> - tleish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top