Solved

Remove template name from GetCurrentTemplatePath()

Posted on 2006-07-13
7
260 Views
Last Modified: 2013-12-24
How can I show just the path to the template without the index.cfm?
0
Comment
Question by:Brian Coughter
7 Comments
 
LVL 13

Expert Comment

by:usachrisk1983
ID: 17102321
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
 
LVL 13

Expert Comment

by:usachrisk1983
ID: 17102339
Ooops, didn't see the title.  If you're using GetCurrentTemplatePath(), then do:

<cfset variables.templateFolder = ListDeleteAt(GetCurrentTemplatePath(),listlen(GetCurrentTemplatePath(),'\'),'\')>
0
 
LVL 9

Expert Comment

by:73Spyder
ID: 17102340

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 9

Expert Comment

by:73Spyder
ID: 17102353
Or.... you could just folloe usachrisk1983    post.


did not see it when I posted
0
 
LVL 9

Expert Comment

by:73Spyder
ID: 17102359
Or follow even.  It helps to be able to spell.
0
 
LVL 5

Accepted Solution

by:
mrigsby earned 500 total points
ID: 17173460
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
 

Author Comment

by:Brian Coughter
ID: 17175384
Thanks.  That was the easy way I was looking for.
0

Featured Post

Network it in WD Red

There's an industry-leading WD Red drive for every compatible NAS system to help fulfill your data storage needs. With drives up to 8TB, WD Red offers a wide array of solutions for customers looking to build the biggest, best-performing NAS storage solution.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now