I've read somewhere that using multiple <cfinvoke>s actually
re-initializes the object with each <cfinvoke>. Is this true? This was
circa CFMX 6.1, so it may have been fixed with CFMX 7.
The only time I use <cfinvoke> is when I need to be able to called
methods dynamically.
Otherwise...
<cfscript>
oCFC = createobject("component","somepackage.somecfc");
-or-
variables.cfc = "somepackage.somecfc";
oCFC = createobject("component",variables.cfc);
results = oCFC.methodNameHere();
</cfscript>
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Joe Rinehart
Sent: Thursday, August 25, 2005 9:16 AM
To: [email protected]
Subject: Re: [CFCDev] cfinvoke vs createobject()
> One reason to do <cfinvoke> over createobject is you can dynamically
> call different methods. I do not think you can do this with
> createobject.
Actually, you can, but it requires using both. CFInvoke allows a
component instance for the "component" attribute. This allows you to
dynamically invoke methods on an instance of a stateful component:
<cfset someinstance = createObject("component", "someCFC").init() />
<cfinvoke component="#someinstance#" method="#somemethod#"
variable="result">
<cfinvoke component="#someinstance#" method="#someOtherMethod#"
variable="result">
-Joe
--
Get Glued!
The Model-Glue ColdFusion Framework
http://www.model-glue.com
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject of
the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject of the
email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]