Kind of off the topic, but you can also set dynamic variables like this:

<cfset "attributes.#foo#" = true>

This is of particular use when you have a series of variables that have
differeing numeric portions, but are not struct keys.  For instance an
hierarchical menu structure, where each menu is stored with a variable
like 'menu_#menuID#'.

<cfset "menu_#menuID#" = makeMenu(...)>

You don't need the evaluate() call around the variable because it's an
lvalue (a destination address for something), rather than an rvalue (the
value at a source address).  I took compilers too long ago to be able to
explain it better than that, but the bottom line is you only need
evaluate on the right side of the assignment operator.

<cfset "menu_#menuID#" = evaluate("menu_#storedMenuID#")>

cheers,
barneyb

-----Original Message-----
From: Bert Dawson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 11, 2002 5:03 PM
To: '[EMAIL PROTECTED]'
Subject: RE: attributes as struct


but the attributes structure is created in FB (unless you call youre app
as
a tag), previously in formurl2attributes, and now in the core file, so
can't
see why you'd need to duplicate this...maybe there is something dodgy
about
you're version of formurl2attributes - what version are you using?

Once its a structure then there are a number of different ways to set a
value:

1. <cfset attributes.foo = true>
2. <cfset attributes["foo"] = true>
3. <cfset SetVariable("attributes.foo", true)>
4. <cfset StructInsert(attributes, "foo", true, true)>

Personally i'll use 1, unless the key is dynamic in which case i'll use
2.

Bert

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.370 / Virus Database: 205 - Release Date: 6/5/2002

==^================================================================
This email was sent to: [email protected]

EASY UNSUBSCRIBE click here: http://topica.com/u/?bUrFMa.bV0Kx9
Or send an email to: [EMAIL PROTECTED]

T O P I C A -- Register now to manage your mail!
http://www.topica.com/partner/tag02/register
==^================================================================

Reply via email to