...

View Full Version : Reorder an array somehow..?



samuurai
08-06-2008, 10:37 PM
Hi,

I'm working on a script which will automatically create a htm file ready to be emailed out as our newsletter. The url is here:


http://www.aquacouture.co.uk/email/tmp.php?makeemail=yes&photodir=June_08

The images are displayed in order of filename. I want to somehow be able to group images so images that are of the same clothing are grouped together.

I can think of one method, where a simple number is entered into the form to determine order, but then how do I unravel my array with all the filenames in that order?

POINT TWO: The other thing I need to be able to do, once I click "make email" I need to write that to a file somehow. How can I have the html generated from the php page written to a file?
Cheers,

Beren

oesxyl
08-06-2008, 11:54 PM
Hi,

I'm working on a script which will automatically create a htm file ready to be emailed out as our newsletter. The url is here:


http://www.aquacouture.co.uk/email/tmp.php?makeemail=yes&photodir=June_08

The images are displayed in order of filename. I want to somehow be able to group images so images that are of the same clothing are grouped together.

I can think of one method, where a simple number is entered into the form to determine order, but then how do I unravel my array with all the filenames in that order?
you can build a hash array with filename as key and the number as values and use asort to sort the array and preserve the key association. This way all filenames with same number will be grouped toghether.


regards

samuurai
08-07-2008, 01:17 AM
asort... that's what I needed... thank you!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum