RE: "including" functions

2007-03-21 Thread Ben Nadel
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:



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


RE: "including" functions

2007-03-21 Thread Leitch, Oblio
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.

-Original Message-
From: Ben Nadel [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 20, 2007 11:31 AM
To: CF-Talk
Subject: RE: "including" functions

A, I see what you are doing :)

To solve this, just include the CFFunction tag in the INCLUDE file
itself. This will still properly define the function within the parent
CFC. And, since you have to have CFFunction tag to have VAR and what
not, this will work fine.

The THIS and VARIABLES scope will act just like you want them to.


 
 
 



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

This email message may contain privileged and/or confidential information. If 
you are not the intended recipient(s), you are hereby notified that any 
dissemination, distribution, or copying of this email message is strictly 
prohibited. If you have received this message in error, please immediately 
notify the sender and delete this email message from your computer.

CAUTION: The Agency of Human Services cannot ensure the confidentiality or 
security of email transmissions.

~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ 

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


RE: "including" functions

2007-03-20 Thread Ben Nadel
A, I see what you are doing :)

To solve this, just include the CFFunction tag in the INCLUDE file
itself. This will still properly define the function within the parent
CFC. And, since you have to have CFFunction tag to have VAR and what
not, this will work fine.

The THIS and VARIABLES scope will act just like you want them to.


 
 
 



..
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: Tuesday, March 20, 2007 10:45 AM
To: CF-Talk
Subject: RE: "including" functions

Well, I've isolated the issue a bit more.  I guess what kills me is I
can't do this:


  
  


Instead, I have to do this:


  
  
  
  
  
  


The first would be a bit more autonomous.


~|
ColdFusion MX7 and Flex 2 
Build sales & marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT

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


RE: "including" functions

2007-03-20 Thread Leitch, Oblio
Well, I've isolated the issue a bit more.  I guess what kills me is I
can't do this:


  
  


Instead, I have to do this:


  
  
  
  
  
  


The first would be a bit more autonomous.



-Original Message-
From: Ben Nadel [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 19, 2007 5:12 PM
To: CF-Talk
Subject: RE: "including" functions

Can you show us the code for the function definition And then also
the snippet that invokes the method.

This email message may contain privileged and/or confidential information. If 
you are not the intended recipient(s), you are hereby notified that any 
dissemination, distribution, or copying of this email message is strictly 
prohibited. If you have received this message in error, please immediately 
notify the sender and delete this email message from your computer.

CAUTION: The Agency of Human Services cannot ensure the confidentiality or 
security of email transmissions.

~|
Upgrade to Adobe ColdFusion MX7
The most significant release in over 10 years. Upgrade & see new features.
http://www.adobe.com/products/coldfusion?sdid=RVJR

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


Re: "including" functions

2007-03-20 Thread Martin Thorpe
You can inject one object (CFC) into another then the functions and properties 
of the injected cfc would be available to the one you are injecting it into.  
For example you have an argument, possibly in the init function, that accepts 
the name of the CFC as the type of the argument.



>I'd like to be able to create one file per function and "include" them
>when the component is instantiated.
>
>You could use the "extends" property of the CFC or you could modify the
>base CFC, but those may not be what you are looking for.
>
>For a more mix-and-match approach, I think you may want to look into the
>"mixins" concept.  Hal Helms has been speaking on this considerably
>recently.
>
>
>Confidentiality Notice:  This message including any
>attachments is for the sole use of the intended
>recipient(s) and may contain confidential and privileged
>information. Any unauthorized review, use, disclosure or
>distribution is prohibited. If you are not the
>intended recipient, please contact the sender and
>delete any copies of this message.

~|
ColdFusion MX7 by Adobe®
Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. 
Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV

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


RE: "including" functions

2007-03-19 Thread Ben Nadel
Can you show us the code for the function definition And then also
the snippet that invokes the method.


..
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: Monday, March 19, 2007 4:14 PM
To: CF-Talk
Subject: RE: "including" functions

Well, I guess, specifically, this is what I've got: in Application.cfc,
I'm defining a new function reSubstring(); in there, I'm cfincluding a
chunk that does the actual processing.  When I try to run it, it fails
to execute (without throwing an error).

-Original Message-
From: Ben Nadel [mailto:[EMAIL PROTECTED]
Sent: Monday, March 19, 2007 3:41 PM
To: CF-Talk
Subject: RE: "including" functions

Oblio,

Using CFInclude should actually provie proper THIS / VARIABLES scope to
which ever CFC does the including. THIS and VARIABLES binding is done at
run time and will actually be accurate if two CFC SHARE the same
function pointer. Do you actually get an error from using CFInclude or
were just assuming this would not work (or am I just not understanding
what you meant)? 

This email message may contain privileged and/or confidential
information. If you are not the intended recipient(s), you are hereby
notified that any dissemination, distribution, or copying of this email
message is strictly prohibited. If you have received this message in
error, please immediately notify the sender and delete this email
message from your computer.

CAUTION: The Agency of Human Services cannot ensure the confidentiality
or security of email transmissions.



~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ 

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


RE: "including" functions

2007-03-19 Thread Leitch, Oblio
Well, I guess, specifically, this is what I've got: in Application.cfc,
I'm defining a new function reSubstring(); in there, I'm cfincluding a
chunk that does the actual processing.  When I try to run it, it fails
to execute (without throwing an error).

-Original Message-
From: Ben Nadel [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 19, 2007 3:41 PM
To: CF-Talk
Subject: RE: "including" functions

Oblio,

Using CFInclude should actually provie proper THIS / VARIABLES scope to
which ever CFC does the including. THIS and VARIABLES binding is done at
run time and will actually be accurate if two CFC SHARE the same
function pointer. Do you actually get an error from using CFInclude or
were just assuming this would not work (or am I just not understanding
what you meant)? 

This email message may contain privileged and/or confidential information. If 
you are not the intended recipient(s), you are hereby notified that any 
dissemination, distribution, or copying of this email message is strictly 
prohibited. If you have received this message in error, please immediately 
notify the sender and delete this email message from your computer.

CAUTION: The Agency of Human Services cannot ensure the confidentiality or 
security of email transmissions.

~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW

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


RE: "including" functions

2007-03-19 Thread Leitch, Oblio
-Original Message-
From: Ian Skinner [mailto:[EMAIL PROTECTED] 

You could use the "extends" property of the CFC or you could modify the
base CFC, but those may not be what you are looking for.

Nope.  I think I'd end up with a serial chain of CFCs, rather than a
library of functions.

For a more mix-and-match approach, I think you may want to look into the
"mixins" concept.  Hal Helms has been speaking on this considerably
recently.

I've seen his baseComponent.cfc, but he's never written any real
"how-to" with it.

This email message may contain privileged and/or confidential information. If 
you are not the intended recipient(s), you are hereby notified that any 
dissemination, distribution, or copying of this email message is strictly 
prohibited. If you have received this message in error, please immediately 
notify the sender and delete this email message from your computer.

CAUTION: The Agency of Human Services cannot ensure the confidentiality or 
security of email transmissions.

~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW

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


RE: "including" functions

2007-03-19 Thread Ben Nadel
Oblio,

Using CFInclude should actually provie proper THIS / VARIABLES scope to
which ever CFC does the including. THIS and VARIABLES binding is done at
run time and will actually be accurate if two CFC SHARE the same
function pointer. Do you actually get an error from using CFInclude or
were just assuming this would not work (or am I just not understanding
what you meant)? 


..
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: Monday, March 19, 2007 3:31 PM
To: CF-Talk
Subject: "including" functions

Is there a good way to create component libraries?  I'm finding that I'm
creating components with *lots* of functions in them.  I'd like to be
able to create one file per function and "include" them when the
component is instantiated.  The  is nice, but it's designed
for 'custom tags', not functions.  And, using  doesn't
provide proper scope access to local (var) variables.  Any thoughts?


This email message may contain privileged and/or confidential
information. If you are not the intended recipient(s), you are hereby
notified that any dissemination, distribution, or copying of this email
message is strictly prohibited. If you have received this message in
error, please immediately notify the sender and delete this email
message from your computer.

CAUTION: The Agency of Human Services cannot ensure the confidentiality
or security of email transmissions.




~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW

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


RE: "including" functions

2007-03-19 Thread Leitch, Oblio
Because I'm trying to avoid "the whole mess" that comes of having too
many functions in one file.

-Original Message-
From: Andy Matthews [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 19, 2007 3:36 PM
To: CF-Talk
Subject: RE: "including" functions

Why not put them into a CFC? Then you can instantiate the whole mess? 

This email message may contain privileged and/or confidential information. If 
you are not the intended recipient(s), you are hereby notified that any 
dissemination, distribution, or copying of this email message is strictly 
prohibited. If you have received this message in error, please immediately 
notify the sender and delete this email message from your computer.

CAUTION: The Agency of Human Services cannot ensure the confidentiality or 
security of email transmissions.

~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW

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


RE: "including" functions

2007-03-19 Thread Andy Matthews
Why not put them into a CFC? Then you can instantiate the whole mess? 

-Original Message-
From: Leitch, Oblio [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 19, 2007 2:31 PM
To: CF-Talk
Subject: "including" functions

Is there a good way to create component libraries?  I'm finding that I'm
creating components with *lots* of functions in them.  I'd like to be able
to create one file per function and "include" them when the component is
instantiated.  The  is nice, but it's designed for 'custom tags',
not functions.  And, using  doesn't provide proper scope access
to local (var) variables.  Any thoughts?



~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 & 
Flex 2
Free Trial 
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU

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


RE: "including" functions

2007-03-19 Thread Ian Skinner
I'd like to be able to create one file per function and "include" them
when the component is instantiated.

You could use the "extends" property of the CFC or you could modify the
base CFC, but those may not be what you are looking for.

For a more mix-and-match approach, I think you may want to look into the
"mixins" concept.  Hal Helms has been speaking on this considerably
recently.


Confidentiality Notice:  This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message. 



~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW

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