Copy link to clipboard
Copied
Is something like this planned as an update? When?
Currently we have to write really ugly code (script and tag code mixed) to get some legacy module files loaded into our components. I'm not talking about few files here, we have been using CF since version 5 and refactoring everything isn't an option.
Only workaround seems to create the ModuleTag java object in the coldfusion.tagext.lang package and call out the module that way. This is really hacky though since cfusion.jar can have class updates. Or perhaps there are some better solutions?
Copy link to clipboard
Copied
According to a blog by Adam Cameron from 2014, you _can_ use CFMODULE in CFSCRIPT - it's just module(arg,arg), not cfmodule(arg,arg).
HTH,
^_^
Copy link to clipboard
Copied
That might be the case with Railo server which we don't use.
Both cfmodule & module methods give undefined variable error.
We are running CF10
Copy link to clipboard
Copied
That's because the cfmodule script equivalent of <cfmodule> wasn't added until CF11.
-Carl V.
Copy link to clipboard
Copied
<!---
Variables = new module(template="/cfm/filepath/file.cfm", {arg1="a", arg2="b"}, Variables)
--->
<
cfcomponent
>
<
cffunction
name=
"init"
output=
"True"
access=
"Public"
returnType=
"Any"
>
<
cfargument
name=
"template"
type=
"String"
required=
"True"
>
<
cfargument
name=
"moduleArguments"
default=
"#StructNew()#"
>
<
cfargument
name=
"superVariables"
default=
"#StructNew()#"
>
<
cfmodule
template=
"#Arguments.template#"
attributecollection=
"#Arguments.moduleArguments#"
/>
<
cfset
StructDelete
(Variables,
"init"
)>
<
cfset
StructDelete
(Variables,
"this"
)>
<
cfreturn
StructAppend
(Arguments.superVariables, Variables)>
</
cffunction
>
</
cfcomponent
>
// Variables = new module("/path/file.cfm", {arg1="", arg2=""}, Variables);
This is the wrapper I've been working on so far.