This content has been marked as final. Show 6 replies
> caller template? I am aware of the CALLER scope within CFMODULES however, I
> was wondering if there is a scope to go the other direction so templates can
> get the variables within the cfmodule?
<!--- in module template --->
<cfset caller.apples = "yes">
<!--- in calling template --->
Thanks for the reply Adam.
I am aware of the CALLER scope to send data from the module back to the calling template. However, what I want is to be able to reference variables within the module from within the calling template.
It seems like if we could name the instance of the module, we should be able to reference these variables using the named instance before the variable name. like #MyModuleName.VariableName#.
Perhaps there is no way to do this in the current verion of Coldfusion, or perhaps there is a variable scope I am unaware of?
I understood what you asked.
Did you read the docs I sent you?
The closest thing to what you want is to put the values in the caller
scope. That said, you should really NOT want to be doing what you're doing
anyhow, as the calling code should not "interested" in the vagaries of what
goes on in the module. It's te whole idea of using modules...
abstracting/hiding processing from the calling code.
What are you trying to achieve?
I am trying to create CFMODULE pages that may be called from either a CFMODULE tag or a CFINCLUDE. There are some cases where I want to protect variable names and others where it is not as important.
I was hoping to eliminate the need for setting variables to the CALLER scope within the cfmodule. If there would be a way for me to access the variables in the module from the calling template it would give me more flexibility.
Perhaps the best way to do this is to have the module page check to see if indeed it is a module first and then through a series of CFIF statements set variables normally or via the caller scope.
> I was hoping to eliminate the need for setting variables to the CALLER scope
> within the cfmodule.
Given this is the way to achieve what you want to do, why do you want to
There is no "special scope". All the local memory from the module is
released when it finishes. To effect what you want to do, you need to set
values in a scope other than the local memory scope of the module. The
most appropriate is in the variables scope of the calling code, which you
do via the caller scope. That's it. That's the answer.
If you think it's NOT the answer, it would really help your cause if you
could explain *what you're actually trying to achieve*, and why you don't
want to use the caller scope.
Bottom Line: There is no way to access variables that are set in a CFMODULE. You must use the CALLER scope to transfer variable values to the calling template.
Thanks Adam. Have a good holiday.