android6011 Posted March 21, 2007 Share Posted March 21, 2007 I have an xml file that looks roughly like this: <?xml version="1.0" encoding="ISO-8859-1" ?> <videos> <video url="new.flv" desc="Guitar Solo" /> </videos> what i want to be able to do is add more entries like "<video url="new.flv" desc="Guitar Solo" />". How can I get it to add the entry into the right place, so it doesnt show up after the </videos>? Quote Link to comment https://forums.phpfreaks.com/topic/43715-php-edit-xml-file/ Share on other sites More sharing options...
per1os Posted March 21, 2007 Share Posted March 21, 2007 <?xml version="1.0" encoding="ISO-8859-1" ?> <videos> <?php $arrayEntrys = array("extra.flv" => "Extra", "new.flv" => "Guitar Solog"); foreach ($arrayEntrys as $url => $desc) { print '<video url="'.$url.'" desc="'.$desc.'" /> } ?> </videos> Quote Link to comment https://forums.phpfreaks.com/topic/43715-php-edit-xml-file/#findComment-212215 Share on other sites More sharing options...
android6011 Posted March 21, 2007 Author Share Posted March 21, 2007 so how should i use that along with opening the existing .xml file and save it? Quote Link to comment https://forums.phpfreaks.com/topic/43715-php-edit-xml-file/#findComment-212223 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.