?
Solved

Remove template name from GetCurrentTemplatePath()

Posted on 2006-07-13
7
Medium Priority
?
264 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
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
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 …
Suggested Courses

765 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