Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 268
  • Last Modified:

Remove template name from GetCurrentTemplatePath()

How can I show just the path to the template without the index.cfm?
0
Brian Coughter
Asked:
Brian Coughter
1 Solution
 
usachrisk1983Commented:
If you're looking for the Physical Path, use:

<cfset variables.templateFolder = ListDeleteAt(cgi.cf_template_path,listlen(cgi.cf_template_path,'\'),'\')>
(change shashes if on non-Windows box)

If you're looking for the web path, use:
<cfset variables.urlDirectory = ListDeleteAt(cgi.script_name,listlen(cgi.script_name,'/'),'/')>
0
 
usachrisk1983Commented:
Ooops, didn't see the title.  If you're using GetCurrentTemplatePath(), then do:

<cfset variables.templateFolder = ListDeleteAt(GetCurrentTemplatePath(),listlen(GetCurrentTemplatePath(),'\'),'\')>
0
 
73SpyderCommented:

Not sure if this is would work the same, but in BlueDragon, we have a cgi var called cgi.cf_template_path
If you have a cgi var that is the same, the code below would work with the var new_path being the path you want


<cfset page_name = ListLast("#cgi.cf_template_path#", "\")>
<cfset temp_len = len(#page_name#)>
<cfset whole_len = len(#cgi.cf_template_path#)>
<cfset new_len = whole_len - temp_len>
<cfset new_path = left(#cgi.cf_template_path#, #new_len#)>
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
73SpyderCommented:
Or.... you could just folloe usachrisk1983    post.


did not see it when I posted
0
 
73SpyderCommented:
Or follow even.  It helps to be able to spell.
0
 
mrigsbyCommented:
If you looking to just return the path to the current templates directory I always just use #GetDirectoryFromPath(GetCurrentTemplatePath())# Seems a whole lot easier to me.
0
 
Brian CoughterOwnerAuthor Commented:
Thanks.  That was the easy way I was looking for.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now