• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 222
  • Last Modified:

Get Calling Template Directory from CFC

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
goldentine
Asked:
goldentine
  • 2
1 Solution
 
rob_lorentzCommented:

try looking at the http.path_info or http.path_translated variables.
0
 
goldentineAuthor Commented:
Those variables return the name of the template that the web browser is currently on, not the page that actually called the CFC...
0
 
rob_lorentzCommented:
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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