You could use <cfobject>
or
<cfscript>
createObject("component","path.to.cfc");
</cfscript>
I prefer the <cfscript> method. It allows you to instantiate an object
without calling a method. It probably has more to do with the fact that I
prefer the write code in script blocks rather than <CF...> Tags.
Regards,
Matt Knight | w:972.361.9943 | m:214.213.4016
-----Original Message-----
From: Paul Giesenhagen [mailto:[EMAIL PROTECTED]
Sent: Friday, October 03, 2003 2:19 PM
To: [EMAIL PROTECTED]
Subject: [CFCDev] CFINVOKE vs. CFOBJECT -- which way and why?
I am curious about the code below ... is there a BETTER way to call this
with CFOBJECt and if so, why?
Once I build the struct "customer" I am going to stick it into a session
named customer.
I am using CFINVOKE This way:
<!--- CFM Template --->
<cfinvoke
component="customerController"
method="getCustomer"
returnvariable="customer">
<cfinvokeargument name="customerID" value="#checkCustomer.customerID#">
</cfinvoke>
<!--- customerController.cfc --->
<cfcomponent displayname="customer" hint="Controls all access to customer
information add, edit, delete."> <cffunction name="getCustomer"
output="false" returntype="struct" displayname="Selects Customer" hint="Gets
customer information and populates cthe customer structure.">
<cfquery datasource="qdc2" name="checkCustomer">
SELECT customerID, firstName, lastName, email, company, address1,
address2,
city, state, country, zip, dayPhone, evePhone, mailList
FROM customer
WHERE customerID = <cfqueryparam value="#arguments.customerID#"
cfsqltype="CF_SQL_INTEGER">
</cfquery>
<cfif checkCustomer.recordcount>
<cfset customer = StructNew()>
<cfset customer.customerID = checkCustomer.customerID>
<cfset customer.firstName = checkCustomer.firstName>
<cfset customer.lastName = checkCustomer.lastName>
<cfset customer.company = checkCustomer.company>
<cfset customer.email = checkCustomer.email>
<cfset customer.address1 = checkCustomer.address1>
<cfset customer.address2 = checkCustomer.address2>
<cfset customer.city = checkCustomer.city>
<cfset customer.state = checkCustomer.state>
<cfset customer.zip = checkCustomer.zip>
<cfset customer.country = checkCustomer.country>
<cfset customer.dayPhone = checkCustomer.dayPhone>
<cfset customer.evePhone = checkCustomer.evePhone>
<cfset customer.mailList = checkCustomer.mailList>
<!--- Insert Shipping Information --->
<cfset customer.shipFirstName = "">
<cfset customer.shipLastName = "">
<cfset customer.shipCompany = "">
<cfset customer.shipAddress1 = "">
<cfset customer.shipAddress2 = "">
<cfset customer.shipCity = "">
<cfset customer.shipState = "">
<cfset customer.shipZip = "">
<cfset customer.shipCountry = "">
<cfset customer.shipDayPhone = "">
<cfelse>
<!--- Do something else --->
</cfif>
<cfreturn customer>
</cffunction>
</cfcomponent>
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).
An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]