Oblio,

As you have found out, CFC creation paths are relative to the CALLING
template, not the compiled-post-include-rendering-and-all-that-jazz
object. Therefore, the CFC path is relative the included template, not
the CFC. One option to over come this is to have a CreateCFC() method in
an included template that is in a higher directory:

<cfinclude template="../../_fn_CreateCFC.cfm" />

Then, in each of your other include functions, you can assume that
THIS.CreateCFC() is a valid method of the current component. Then,
instead of calling CreateObject() with your path, call THIS.CreateCFC(
"component_name" ) and you can handle all of the path stuff in the
CreateCFC() method which will be higher than the current directory.

Make sense? 

Here is a blog entry on the proof of concept (but not using CFCs
exactly):

http://www.bennadel.com/index.cfm?dax=blog:348.view


......................
Ben Nadel
Certified Advanced ColdFusion MX7 Developer
www.bennadel.com
 
Need ColdFusion Help?
www.bennadel.com/ask-ben/

-----Original Message-----
From: Leitch, Oblio [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 21, 2007 8:36 AM
To: CF-Talk
Subject: RE: "including" functions

Well, this is good to know.  However, I'm still running into trouble.
Now that I've removed the functions to a subdirectory, all the code
inside has to be modified to look for dependencies relatively.  For
example in my CFC, I instantiate another component in a subdirectory
thus: component="subdir.component".  However, when I remove the function
to the same directory, I have to remove the "subdir." from the component
location.  In other words, even though the parent.cfc includes
subdir/function.cfm, the function.cfm executes in context of 'subdir/',
not '../'.

I can't decide whether this is good or bad.  Certainly not expected.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create Web Applications With ColdFusion MX7 & Flex 2. 
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:273253
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to