>>> I am currently calling a cffunction that is on the same page using <cfset
>myVar = GetVar(Toy)>. The GetVar is written on the same page. However I want
>to call another function the same way but it is on a diffrent page. Is there
>a way of calling it with out having to copy and past it into this page?
>Thanks
>
>Matthew,
>
>You can use a CFC.  Create a file called:  user_functions.cfc (or whatever
>you want to call it).
>
><cfcomponent name="user_functions">
>       <cffunction name="getVar">
>               .... your function code here....
>       </cffunction>
></cfcomponent>
>
>Now when you want to call it, you can either use <CFINVOKE> to call it, or
>you can use createObject() to create a variable that represents the CFC and
>then call the function with that variable, like this:
>
><cfset oUserFunctions = createObject("component","user_functions")>
><cfset myVar = oUserFunctions.getVar(Toy)>
>
>Use those lines of code in both your pages.
>
>There are plenty of best practices on the net for CFCs and where you put
>them and naming conventions and so on, but this is the basics for you
>anyway.  You can look up the docs for CFINVOKE if you'd rather use it.
>
>Dave
Dave,
     Thanks. Is one peffered over the other? Is one more friendly to understand 
when reading the code? 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

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

Reply via email to