We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25551 ☆ A M B ☆
    • 1,231 Posts
    Hey folks, I need a little help gathering inputs from an XML feed.

    How can I loop through a dynamic array and gather the results?

    The XML feed simplified looks like this.


    <profile>
    -<person>
    −<mostusedprogram>
    <programname>modx</programname>
    </mostusedprogram>
    </person>

    -<person>
    −<mostusedprogram>
    <programname>SMF</programname>
    </mostusedprogram>
    </person>
    </profile>

    Basically I need to loop through the array to gather the programname options however many values are per person. 1 person might have 2 choices, 4 or whatever and I need to loop through the array without telling how many times to loop and print the result out.

    I’m learning still and I know what I am trying to do but I just don’t know enough about XML and arrays to figure it out.

    I am using php5.2 and have tried some simplexml tutorials but nothing helped. If someone could give me some pointers that would be great.
      Ross Sivills - MD AugmentBLU Edinburgh, Scotland UK
      AugmentBLU - MODX Partner

      BLUcart - MODX Revolution E-Commerce & Shopping Cart