Simone
02/10/2022, 7:19 PMdeactivateduser
02/10/2022, 7:25 PMPeter Hoopes
02/10/2022, 7:27 PMdeactivateduser
02/10/2022, 7:28 PMcfvonner
02/10/2022, 7:31 PMcomponents should be used as included files
tells me that this person only uses CFCs as function libraries, not as "objects" in the way that CFCs are typically used most often in modern CFML apps.cfvonner
02/10/2022, 7:33 PMapplication.myWidget
all over the place.websolete
02/10/2022, 7:34 PMApplication scopes are the most evil scopes and components should be used as included filesif this statement is accurately quoted, then this ranks as one of the most inane and stupid statements related to cf i think i've heard. forget the nuance, it's just dumb on its face
Adam Cameron
deactivateduser
02/10/2022, 7:38 PMdeactivateduser
02/10/2022, 7:40 PMsknowlton
02/10/2022, 7:41 PMAdam Cameron
component {}
, within a file with a .cfc
extension.
Seems to be a pointless abuse of the technology to hand.
Just... put the functions in a .cfm
file.
TBH though... yer not gonna make very many friends writing code like that without good reason.Adam Cameron
deactivateduser
02/10/2022, 7:44 PMAdam Cameron
cfvonner
02/10/2022, 7:45 PMapplication.utility.myFunction()
all over the place. That was my first exposure to using CFCs way back in the day.seancorfield
Adam Cameron
include "My.cfc"
would actually even do. I would have thought it would have just slapped everything within the .cfc file into the including-file's variables scope)deactivateduser
02/10/2022, 7:48 PMcfm
file you then need to make sure you don't include that cfm
file twice when including other cfm
files. So when we came across this we just built out a cfc with the function and instead inside the "library" cfm
file we used that to instantiate the library and have it in a variable. That way if that cfm
file was included twice it didn't doublt define a function, it just rewrote over the variabledeactivateduser
02/10/2022, 7:48 PMwebsolete
02/10/2022, 7:50 PMAdam Cameron
we used that to instantiate the library and have it in a variableYeah, but that's _not "_components should be used as included files"
deactivateduser
02/10/2022, 7:51 PMAdam Cameron
Adam Cameron
Adam Cameron
Adam Cameron
websolete
02/10/2022, 7:54 PMAdam Cameron
websolete
02/10/2022, 7:55 PMwebsolete
02/10/2022, 7:55 PMAdam Cameron
websolete
02/10/2022, 7:56 PMAdam Cameron
websolete
02/10/2022, 7:56 PMAdam Cameron
websolete
02/10/2022, 7:56 PMAdam Cameron
Adam Cameron
Adam Cameron
Adam Cameron
websolete
02/10/2022, 7:58 PMAdam Cameron
<cfapplication name="app1">
<cfset application.myvar = "first application scope">
<cfapplication name="app2">
<cfset application.myvar = "second application scope">
<cfdump var="#application#"> <!--- second application scope --->
<cfapplication name="app1">
<cfdump var="#application#"><!--- first application scope --->
<!--- Tada! multiple application scopes :-) --->
Mark Takata (Adobe)
02/10/2022, 7:59 PMAdam Cameron
Adam Cameron
Mark Takata (Adobe)
02/10/2022, 8:01 PMAdam Cameron
sknowlton
02/10/2022, 8:04 PMMark Takata (Adobe)
02/10/2022, 8:04 PMAdam Cameron
Mark Takata (Adobe)
02/10/2022, 8:05 PMMark Takata (Adobe)
02/10/2022, 8:06 PMAdam Cameron
Adam Cameron
Mark Takata (Adobe)
02/10/2022, 8:07 PMMark Takata (Adobe)
02/10/2022, 8:08 PMAdam Cameron
Adam Cameron
Mark Takata (Adobe)
02/10/2022, 8:10 PMsknowlton
02/10/2022, 8:10 PMMark Takata (Adobe)
02/10/2022, 8:11 PMMark Takata (Adobe)
02/10/2022, 8:11 PMAdam Cameron
Adam Cameron
Adam Cameron
Mark Takata (Adobe)
02/10/2022, 8:15 PMsknowlton
02/10/2022, 8:15 PM