CFModule varaiable passing

I have looked on this site and so far have not been able to find a basic understanding of CFMODULE.

I have 2 pages:
CALLING PAGE contains <cfmodule name="mymodulename.index" var1="11111" var2="22222">

MODULE PAGE is calling for var1, but no varaiable name exists.

The basic connection between the CALLING and MODULE page is fine, but passing the variables just doesn't happen.  What am I missing here?
LVL 1
mopar003Asked:
Who is Participating?
 
sajaycCommented:
Hi,

On the module page, how are you referencing the variable?
It should be #attributes.var1#

Post some code if this doesn't work.

Hope this helps.
0
 
_agx_Commented:
(no points ..)

Just to clarify, cfmodule is like using a custom tag.  Any variables passed to a custom tag (by name) are placed in the tag's "attributes" scope.   It's similar to how cffunction's work. Any values passed into a cffunction are placed in the "arguments" scope.

So inside the tag "var1" becomes #attributes.var1# and "var2" becomes #attributes.var1#.
<cfmodule name="mymodulename.index"
          var1="11111"
          var2="22222">


You can also use attributeCollection to pass in a bunch of arguments at once.

<cfset myArgs = structNew()>
<cfset myArgs.var1 = "11111">
<cfset myArgs.var2 = "22222">

<cfmodule name="mymodulename.index" attributeCollection="#myArgs#">


0
 
mopar003Author Commented:
Thats what I was missing.  Never called it by attributes tag.  Thank you.  I knew it would be a simple thing!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.