Solved

Remove template name from GetCurrentTemplatePath()

Posted on 2006-07-13
7
263 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

 
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

Turn Insights Into Action

You’ve already invested in ITSM tools, chat applications, automation utilities, and more. Fortify these solutions with intelligent communications so you can drive business processes forward.

With xMatters, you'll never miss a beat.

Question has a verified solution.

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

Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
What You Need to Know when Searching for a Webhost Provider
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

717 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