Just curious... Why do you want to use "<cfinclude...> in CFC's. Isnt the very point of CFC's abstraction,encapsulation... Code Behind etc.
Its sounds like Stubborn Spagetti with CFC's. Joe Eugene >-----Original Message----- >From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] >Behalf Of Sean Corfield >Sent: Thursday, July 08, 2004 8:08 PM >To: [EMAIL PROTECTED] >Subject: Re: RE: [CFCDev] using cfinclude within components (was >Serialization of CFCs) > > >On Thu, 08 Jul 2004 03:34:19 -0500, Barry L Beattie <[EMAIL PROTECTED]> wrote: >> 2) mind the difference between cfimport (aka "cftaglib") and >cfinclude. The way the variable scopes interact is a factor to >consider between them. Not always relavent but it can bite you in >the bum... > >Yeah, and the example you then give shows exactly why you should NOT >use cfinclude inside a method! > >> <cffunction name="getData" access="public" output="false" >returntype="struct" >> hint="Get data for a specific objectid and return as a structure, >> including array properties and typename."> >> <cfargument name="objectid" type="uuid" required="true"> >> <cfargument name="dsn" type="string" required="false" >default="#application.dsn#"> >> <cfargument name="dbowner" type="string" required="false" >> default="#ucase(application.dbowner)#"> >> <cfset var stObj = structNew()> >> <cfset var qgetData = ""> >> <cfset var tablename = ""> >> <cfset var aProps = ""> >> <cfset var key = ""> > >Inside the include, all of the above variables are copied from 'var' >local scope to 'variables' instance scope and therefore your CFC is >not thread safe and your local variables overwrite your instance >variables. V.Bad! > >> <cfinclude template="_fourq/getData.cfm"> >> >> <cfset this.bgetData = 1> >> <cfreturn stObj> >> </cffunction> > >And of course don't get me started on the horrific Spectra-like naming >conventions used in FarCry... ;) > >> 3) more and more people are creating persistant (app or server >scope) central or "kernel" CFC's (singletons - only one >instanciated) that have their utils available at all times. You >could also "decorate" your CFC's with the util ones (a "has a" >relationship) > >And as Barney says, this will cause any CFCs using such beasts to >break encapsulation unless you pass the singleton in as a reference at >initialization and save it as an instance variable. Frankly, you might >just as well just call the utility CFC statelessly (via <cfinvoke>)... >---------------------------------------------------------- >You are subscribed to cfcdev. To unsubscribe, send an email >to [EMAIL PROTECTED] with the words '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] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the words '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]
