You asked about a reason to use a structure. I'm currently working on a
custom tag for our company that will allow me to "dynamically" create
horizontal or vertical "tabs" on a web page. To do this I need some
information about how to format the tabs. As such I use a structure. Below
is the code used to create the basic structure. Values within the structure
can be changed later, before the tabs are created. Since I'm still working
on the tag I can pretty much guarantee that this code won't work perfectly.
<CFSET lsStructure = StructNew()>
<CFSET lnNumTabs = VAL(ATTRIBUTES.NumTabs)>
<!--- Set the common structure options --->
<CFSCRIPT>
StructInsert(lsStructure, "NumTabs", "#lnNumTabs#");
StructInsert(lsStructure, "NormalLeft",
"#ATTRIBUTES.NormalLeft#");
StructInsert(lsStructure, "NormalRight",
"#ATTRIBUTES.NormalRight#");
StructInsert(lsStructure, "NormalStyle",
"#ATTRIBUTES.NormalStyle#");
StructInsert(lsStructure, "SelectedLeft",
"#ATTRIBUTES.SelectedLeft#");
StructInsert(lsStructure,
"SelectedRight","#ATTRIBUTES.SelectedRight#");
StructInsert(lsStructure,
"SelectedStyle","#ATTRIBUTES.SelectedStyle#");
StructInsert(lsStructure,
"ClickFunction","#ATTRIBUTES.ClickFunction#");
StructInsert(lsStructure, "DefaultParm",
"#ATTRIBUTES.DefaultParm#");
</CFSCRIPT>
<!--- Create Tab Parameter for Number of tabs --->
<CFIF lnNumTabs GT 0>
<CFLOOP INDEX="lnLoop" FROM="1" TO="#lnNumTabs#">
<CFSET luTemp = StructInsert(lsStructure, "Tab#lnLoop#",
StructNew())>
<CFSET lsTabStru = EVALUATE("lsStructure" & ".Tab#lnLoop#")
<CFSET luTemp = StructInsert(lsTabStru, "ClickParm",
"#ATTRIBUTES.DefaultParm#")
<CFSET luTemp = StructInsert(lsTabStru, "TabText",
"Tab#lnLoop#">
</CFLOOP>
</CFIF>
This structure now comes in handy because when I call my "create tabs" tag I
can pass the base structure and the tag will know what to expect in the
structure and the code is closer to "self documenting".
Hope this helps!
______________________________________________________
Bill Grover
Supervisor IS Department Phone: 301.424.3300 x396
EU Services, Inc. FAX: 301.424.3300 x1396#
649 North Horners Lane E-Mail: mailto:[EMAIL PROTECTED]
Rockville, MD 20850-1299 WWW: www.euservices.com
______________________________________________________
> -----Original Message-----
>
> Date: Mon, 3 Apr 2000 20:58:13 -0400
> From: "Seth Petry-Johnson" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Subject: Re: Stuctures and Arrays, huh? :-)
> Message-ID: <015001bf9dd0$db8ef200$[EMAIL PROTECTED]>
>
> >I've definitely avoided using arrays, and more recently,
> structures (you
> >see, I didn't know about structures until just a while ago ...).
> Basically,
> >I'm having a few conceptual problems on just simply how to
> make, create,
> >edit and add stuff to them. But, even past that, I can't
> think of any
> >practical applications for arrays and structures.
> Obviously, there must be
> >a ton, otherwise they wouldn't be in CF.
>
>
> Arrays
> -----------
<BIG SNIP HERE!>
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.