Solved

Get Calling Template Directory from CFC

Posted on 2006-06-23
6
211 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
[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
  • 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

Schedule a Tour of the ATEN booth at InfoComm 2017

Tour the ATEN booth to see the the Latest Addition to the Modular Matrix Switch Series, New 4K HDMI Over IP Extender and more! Enter ATEN's Ultimate Giveaway Sweepstakes for a chance to win one of several great prizes, including an ATEN US7220 2-Port Thunderbolt 2 Sharing Switch!

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 …
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

688 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