I had to create an xml export using php pulling the info from a database. The last section that needs done adds in node pieces that could range anywhere up to 20 additions.
I can extract the data I need from the database with no problem, but I don't know how to create these sub & sub-children "on-the-fly". By "on-the-fly" I mean that there could be two additions, or there could be up to 20.
This is my placeholder code for where this needs to be done:
// PHOTOS SECTION NEEDS DONE
$node_photos = $doc->createElement("photos");
$newnode2 = $doc->createElement("photo");
$node_photo = $node_photos->appendChild($newnode2);
$node_photo1 = $doc->createElement("url", 'THIS SECTION NEEDS DONE. NEED TO CYCLE THROUGH AND CREATE NODES ON THE FLY.');
This is the example result that has to display:
<title>front view of the home</title>
It may or may not be simple to do this, but I've never used the php code for producing xml up until now, so I'm not sure how to go about this. The photo info (as you can see in the example is what I'm adding in) I can pull that into arrays and iterate through. But I don't understand how to code the add node parts as it iterates.
This is the full display at this point: http://www.manufacturedhomesoregon.net/xml-export/xml-export-test.php
So you can see where the photo info section displays in the output.
Any help is appreciated. I can provide more info if needed.