Jump to content

Scrutters

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Everything posted by Scrutters

  1. I've managed to get it working, but need to look into putting the XML feed into an array on page load as I reference it multiple times on a page it creating quite a load on my server. I think I have the solution for that as well though. Cheers for the help.
  2. Sorry I thought by not putting values it would be obvious: <option value="apple">apple</option>
  3. Using that example, the HTML would need to look to the following: (Or as close as I can get it) <select name="testSelect"> <optgroup label="example"> <option>apple</option> <option>orange</option> <optgroup label="b"> <option>cherry</option> <option>damson</option> </optgroup> <option>elderberry</option> </optgroup> </select> Does that help at all?
  4. Now this is the problem, there isn't just one XML file. There will be potentially numerous XML files in different formats. This is why I need something to list out all available nodes within the feed. Sorry a can't be any more specific, but this is what I need my system to do.
  5. Ideally the select box would end up something like this... <select name="test"> <optgroup label="Parent"> <option value="etc1">etc1</option> <option value="etc2">etc2</option> <optgroup label="etc3"> <option value="abc1">abc1</option> <option value="abc3">abc2</option> </optgroup> </optgroup> </select> I have recieved a reply on another forum which may have answered my question, but open to other suggestions. The suggestion I have had is to try one of the user exmaples on the PHP SimpleXML->children() function page.
  6. Hi, I need something list all the nodes of an XML file in a similar way to how the print_r() function lists out an array. So it will list out all the fields in the correct order but so that I can actually do something with them. Array ( [a] => apple [b] => banana [c] => Array ( [0] => x [1] => y [2] => z ) [d] => Array ( [0] => x [1] => y [2] => Array ( [0] => Keeps going deeper... [1] => etc... ) ) ) I'm trying to create a select box with all the fields in so that I can map the XML file into my database. At the moment I am doing this: foreach($xml->children() as $child1){ foreach($child1->children() as $child2){ foreach($child2->children() as $child3){ // Obviously this could keep going for ages... } } } Really need something that can test to see if there are any children nodes under the current node selected and keep going till it stops then move on the the next parent node. Or something that can count all nodes within the feed and just list them one by one. I'm sure there must be a way to do this, I just can't work out the logic.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.