Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Nov 2007
    Posts
    144
    Thanks
    64
    Thanked 0 Times in 0 Posts

    Reorder an array somehow..?

    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:

    Code:
    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
    Last edited by samuurai; 08-06-2008 at 09:43 PM.

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by samuurai View Post
    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:

    Code:
    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

  • Users who have thanked oesxyl for this post:

    samuurai (08-07-2008)

  • #3
    Regular Coder
    Join Date
    Nov 2007
    Posts
    144
    Thanks
    64
    Thanked 0 Times in 0 Posts
    asort... that's what I needed... thank you!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •