Great, got it. Many thanks for your help.

Andy McShane 
Head of Development
Scout7 Ltd, 
324a Lichfield Road, 
Mere Green, 
Sutton Coldfield 
West Midlands 
United Kingdom 
B74 2UW 

Telephone: +44 (0)121 323 2640 
Mobile : 07866 430783 
Fax: +44 (0)121 323 2010 
Email: mailto:[EMAIL PROTECTED] 
Website: www.scout7.com

-----Original Message-----
From: Deanna Schneider [mailto:[EMAIL PROTECTED] 
Sent: 30 November 2004 13:19
To: CF-Talk
Subject: Re: Best way to access CFC's?

In that example, it will look in the directory of the calling template.
The 
"component" part of the call tells it that you're creating an object of
type 
"component." You can also have a mapping to a directory for components,
and 
you can also use dot notation.
For example:
<cfset myAdder = createObject("component", "addsTwoNumbers") />
    looks in current directory or looks in mapped cfc directory if it's
at 
the root (but I doubt that)
<cfset myAdder = createObject("component", "cfc.addsTwoNumbers") />
    looks in root of directory mapped to /cfc

----- Original Message ----- 
From: "Andy Mcshane" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, November 30, 2004 4:28 AM
Subject: RE: Best way to access CFC's?


> Thanks, that makes it a little clearer. Now for the newbie dumb
> question, how does the code know where to find the components? i.e.
>
> <!--- Instantiate a component that adds two numbers --->
> <cfset myAdder = createObject("component", "addsTwoNumbers") />
>
> Do you have to create a mapping to a directory called component that
> contains all of the CFC's?
>
> Andy McShane
> Head of Development
> Scout7 Ltd,
> 324a Lichfield Road,
> Mere Green,
> Sutton Coldfield
> West Midlands
> United Kingdom
> B74 2UW
>
> Telephone: +44 (0)121 323 2640
> Mobile : 07866 430783
> Fax: +44 (0)121 323 2010
> Email: mailto:[EMAIL PROTECTED]
> Website: www.scout7.com
>
>
> -----Original Message-----
> From: Joe Rinehart [mailto:[EMAIL PROTECTED]
> Sent: 29 November 2004 19:16
> To: CF-Talk
> Subject: Re: Best way to access CFC's?
>
> If you're component is stateful, you'll want to invoke methods on the
> same instance of the component instead of continually creating new
> instances.
>
> <!--- Instantiate a component that adds two numbers --->
> <cfset myAdder = createObject("component", "addsTwoNumbers") />
>
> <!--- Set first number --->
> <cfinvoke
>   component="#myAdder#"
>   method="setNumberOne"
>   <cfinvokeargument
>      name="number"
>      value="2">
> </cfinvoke>
>
> <!--- Set second number --->
> <cfinvoke
>   component="#myAdder#"
>   method="setNumberTwo"
>   <cfinvokeargument
>      name="number"
>      value="3">
> </cfinvoke>
>
> <!--- Get sum --->
> <cfinvoke
>   component="#myAdder#"
>   method="getSum"
>   returnVariable="sum"
> </cfinvoke>
>
> <!--- Displays five --->
> <cfoutput>#sum#</cfoutput>
>
> There's a few different ways to write this....I'd probably use:
>
> <cfset myAdder = createObject("component", "addsTwoNumbers") />
> <cfset myAdder.SetNumberOne(2) />
> <cfset myAdder.SetNumberTwo(3) />
> <cfoutput>#myAdder.getSum()#</cfoutput>
>
> -joe
>
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185652
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to