Solved

Get Calling Template Directory from CFC

Posted on 2006-06-23
6
199 Views
Last Modified: 2013-12-24
Does anyone know how to get the directory path of the calling cfm file in a CFC?

If I use this statement to call a CFC from say this cfm file...  c:\websites\mysite\index.cfm

<cfset projects = CreateObject('Component','cfc.projects')>

The following code in the CFC file then tells me that the directory is "c:\websites\mysite\cfc\", but what I want is "c:\websites\mysite\".

<cfcomponent displayName="projects">
    <cfset this.rootdirectory = getfilefrompath(gettemplatepath())>
</cfcomponent>

Any suggestions?
0
Comment
Question by:goldentine
  • 2
6 Comments
 
LVL 10

Expert Comment

by:rob_lorentz
ID: 16968851

try looking at the http.path_info or http.path_translated variables.
0
 

Author Comment

by:goldentine
ID: 16996082
Those variables return the name of the template that the web browser is currently on, not the page that actually called the CFC...
0
 
LVL 10

Accepted Solution

by:
rob_lorentz earned 125 total points
ID: 17001714
I think you might have to caclulate that and pass it into the component then. I dont think there is away to get information about what/who called the component.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

932 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

10 Experts available now in Live!

Get 1:1 Help Now