images[n].fileLocation = "";
images[n].fileTitle = "";
images[n].fileDescription = "";
Arrays lend themselves to looping better than structures, because the
order of elements returned in a structure loop is undefined. Arrays
will always return in the same order. I heard rumors that the
undefined order was actually a bug, but I don't know if that was true,
or if it's been fixed. Building it with an array is pretty easy as
well:
<cfset images = arrayNew(1) />
<cfloop query="myQuery">
<cfset s = structNew() />
<cfset s.fileLocation = myQuery.file />
<cfset s.fileTitle = myQuery.title />
<cfset s.fileDescription = myQuery.description />
<cfset arrayAppend(images, s) />
</cfloop>
cheers,
barneyb
On Wed, 15 Sep 2004 10:25:07 -0500, Phill B <[EMAIL PROTECTED]> wrote:
> I'm trying to put some picture info into a variable that will be easy
> for the designers to use.
>
> I have to query a database to get specific images. I then tweak the
> results and want to put them into a variable similar to this.
>
> FeaturesOptions.image1.fileLocation = http://www.asdf.com/asdf.jpg
> FeaturesOptions.image1.fileTitle = cool picture
> FeaturesOptions.image1.fileDescription = this is a description of the
> cool picture
> FeaturesOptions.image2.fileLocation = http://www.asdf.com/cvbxb.jpg
> FeaturesOptions.image2.fileTitle = cool picture 2
> FeaturesOptions.image2.fileDescription = this is another description
> of a cool picture
>
> Once they are like this the designer can loop through the variables to
> output what they need.
>
> I've tried to do this using a structure but I can't seem to make it
> work. I am looping over the results of a query and trying to
> dynamically name the structure that I'm putting values into and no
> matter what I do it won't work.
>
> Any suggestion? I can give some code if it will help.
>
> --
> Phillip B.
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

