why would you write a custom tag that performs the same function as an
already-existing CF function??

just use ARRAYAPPEND() function.

For the record though, you would not need to pass the array because it is in
a session variable (which are visible to custom tags already).  If the array
was in a local variable passing #myArray# would pass a pointer to the custom
tag (not the entire array) which could then be manipulated as a local
variable in the custom tag.

                                                    
Bryan Love ACP
Internet Application Developer
[EMAIL PROTECTED]
                                                    


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 07, 2001 8:25 AM
To: CF-Talk
Subject: Passing an array to a custom tag



I am trying to write a custom tag that
will, among other things, add an element
to an array whose name can vary from situation
to situation.  This array is always stored as a
session variable.  I have been trying to pass
the name of the array as a character string
and then manipulate it in the custom tag
with no luck.

Here is how I call the tag:

( session.aDirectoryClicked array is created in Application.cfm
  and initialized earlier )

<CFMODULE template="../BumpHitCounter.cfm" 
        aIDs="aDirectoryClicked"
        nNumIDs=#ArrayLen( session.aDirectoryClicked )#
        ThisID=#URL.DirectoryID#>

=====

Here is a snippet from BumpHitCounter.cfm that does not work:

<CFLOOP INDEX="n" FROM="1" TO="#Attributes.nNumIDs#">
        <CFIF "Caller.#Attributes.aIDs# [n]" EQ Attributes.ThisID>
                <CFSET Variables.WasClicked = "Yes">
                <CFSET n = Attributes.nNumIDs + 1>
        </CFIF>
</CFLOOP>

<CFIF Variables.WasClicked EQ "No">
        <CFSET Variables.tmp = ArrayAppend( "Caller.#Attributes.aIDs#",
#Attributes.ThisID# )>
</CFIF>

=====

Here is the error message that is thrown:

Error Diagnostic Information

 Parameter 1 of function ArrayAppend which is now
"Caller.aDirectoryClicked" must be an array

 The error occurred while evaluating the expression: 

  Variables.tmp = ArrayAppend( "Caller.#Attributes.aIDs#",
#Attributes.ThisID# )

=====

Any ideas?

Thanks in advance.

Joe Tartaglia
High Caliber Systems

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to