Jump to content

burnthand

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

burnthand's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Here are the functions for generating the playlists, they aren't working at the moment because the DOMDocument keeps adding an xml declaration and putting the nodes in the wrong place. function addTrack( &$doc , &$track ) { $r = $doc->documentElement; $b = $doc->createElement( "track" ); $elements = array( 'title', 'creator', 'location', 'image', 'info', 'identifier' ); foreach( $elements as $element ){ $createEl = $doc->createElement( $element ); $createEl->appendChild( $doc->createTextNode( $track[$element] )); $b->appendChild( $createEl ); } $r->appendChild( $b ); } function updatePlaylist() { } function createPlaylist( $path , $tracks ) { $doc = new DOMDocument(); $doc->formatOutput = true; foreach( $tracks as $track ){ $b = $doc->createElement( "track" ); $elements = array( 'title', 'creator', 'location', 'image', 'info', 'identifier' ); foreach( $elements as $element ){ $createEl = $doc->createElement( $element ); $createEl->appendChild( $doc->createTextNode( $track[$element] ) ); $b->appendChild( $createEl ); } $r->appendChild( $b ); } echo $doc->save( $path . 'playlist.xml' ); } // read each filename as an entry /* while ( false !== ( $file = readdir( $newhandle ) ) ){ // if the current entry is a . or a .. exclude it from the listing if ( $file != "." && $file != ".." ){ echo "$file<br/>"; array_push( $files, $file ); } } */ ?> heres the output <?xml version="1.0"?> <playlist xmlns="http://xspf.org/ns/0/" version="1"> <trackList> <track> <title>Homeland</title> <creator>Postman</creator> <location>http://www.jeroenwijering.com/upload/postmen.mp3</location> <image>http://www.jeroenwijering.com/upload/postmen.jpg</image> <info><![CDATA[http://www.amazon.com/Revival-Postmen/dp/B00005J8R7/sr=1-6/qid=1166887655/ref=sr_1_6/105-9454024-2355627?ie=UTF8&s=music]]></info> <identifier>456</identifier> </track> <track> <title>Jazzalude</title> <creator>Basement Jaxx</creator> <location>http://www.jeroenwijering.com/upload/basement.mp3</location> <image>http://www.jeroenwijering.com/upload/basement.jpg</image> <identifier>123</identifier> <info><![CDATA[http://www.amazon.com/Rooty-Basement-Jaxx/dp/B00005K9V5/sr=8-3/qid=1166887603/ref=pd_bbs_sr_3/105-9454024-2355627?ie=UTF8&s=music]]></info> </track> <track> <title>Sunshine Up Ahead</title> <creator>Peter Jones</creator> <location>http://www.jeroenwijering.com/upload/peterjones.mp3</location> <image>http://www.jeroenwijering.com/upload/peterjones.jpg</image> <info>http://www.peterjonesmusic.net</info> <identifier>789</identifier> </track> </trackList> <track><title>test3</title><creator>HB</creator><location>./music/011207/</location><image></image><info></info><identifier></identifier></track></playlist>
  2. sorry for the late reply. This is the demo xml file that comes with the media player, so the track listings are irrelivent. Desired xml output: <playlist version="1" xmlns="http://xspf.org/ns/0/"> <trackList> <track> <title>Homeland</title> <creator>Postman</creator> <location>http://www.jeroenwijering.com/upload/postmen.mp3</location> <image>http://www.jeroenwijering.com/upload/postmen.jpg</image> <info><![CDATA[http://www.amazon.com/Revival-Postmen/dp/B00005J8R7/sr=1-6/qid=1166887655/ref=sr_1_6/105-9454024-2355627?ie=UTF8&s=music]]></info> <identifier>456</identifier> </track> <track> <title>Jazzalude</title> <creator>Basement Jaxx</creator> <location>http://www.jeroenwijering.com/upload/basement.mp3</location> <image>http://www.jeroenwijering.com/upload/basement.jpg</image> <identifier>123</identifier> <info><![CDATA[http://www.amazon.com/Rooty-Basement-Jaxx/dp/B00005K9V5/sr=8-3/qid=1166887603/ref=pd_bbs_sr_3/105-9454024-2355627?ie=UTF8&s=music]]></info> </track> <track> <title>Sunshine Up Ahead</title> <creator>Peter Jones</creator> <location>http://www.jeroenwijering.com/upload/peterjones.mp3</location> <image>http://www.jeroenwijering.com/upload/peterjones.jpg</image> <info>http://www.peterjonesmusic.net</info> <identifier>789</identifier> </track> <track> <title>Jazzalude</title> <creator>Basement Jaxx</creator> <location>http://www.jeroenwijering.com/upload/basement.mp3</location> <image>http://www.jeroenwijering.com/upload/basement.jpg</image> <info><![CDATA[http://www.amazon.com/Rooty-Basement-Jaxx/dp/B00005K9V5/sr=8-3/qid=1166887603/ref=pd_bbs_sr_3/105-9454024-2355627?ie=UTF8&s=music]]></info> <identifier>123</identifier> </track> <track> <title>Homeland</title> <creator>Postman</creator> <location>http://www.jeroenwijering.com/upload/postmen.mp3</location> <image>http://www.jeroenwijering.com/upload/postmen.jpg</image> <info><![CDATA[http://www.amazon.com/Revival-Postmen/dp/B00005J8R7/sr=1-6/qid=1166887655/ref=sr_1_6/105-9454024-2355627?ie=UTF8&s=music]]></info> <identifier>456</identifier> </track> </trackList> Actual XML output: <?xml version="1.0"?> <playlist xmlns="http://xspf.org/ns/0/" version="1"> <trackList> <track> <title>Homeland</title> <creator>Postman</creator> <location>http://www.jeroenwijering.com/upload/postmen.mp3</location> <image>http://www.jeroenwijering.com/upload/postmen.jpg</image> <info><![CDATA[http://www.amazon.com/Revival-Postmen/dp/B00005J8R7/sr=1-6/qid=1166887655/ref=sr_1_6/105-9454024-2355627?ie=UTF8&s=music]]></info> <identifier>456</identifier> </track> <track> <title>Jazzalude</title> <creator>Basement Jaxx</creator> <location>http://www.jeroenwijering.com/upload/basement.mp3</location> <image>http://www.jeroenwijering.com/upload/basement.jpg</image> <identifier>123</identifier> <info><![CDATA[http://www.amazon.com/Rooty-Basement-Jaxx/dp/B00005K9V5/sr=8-3/qid=1166887603/ref=pd_bbs_sr_3/105-9454024-2355627?ie=UTF8&s=music]]></info> </track> <track> <title>Sunshine Up Ahead</title> <creator>Peter Jones</creator> <location>http://www.jeroenwijering.com/upload/peterjones.mp3</location> <image>http://www.jeroenwijering.com/upload/peterjones.jpg</image> <info>http://www.peterjonesmusic.net</info> <identifier>789</identifier> </track> </trackList> </playlist> Currently I have to add the </playlist> closing tag as well otherwise the DOMDocument won't parse the XML at all.
  3. Hi there ppl I'm using the DOMdocument object to interact with XML playlist files for a music archive site that we are updating/building to archive our many free form jam sessions over the last few years - go to www.merecoincidence.co.uk if you're interested in hearing some random impro. The XML files need to have an XML declaration that reads <playlist version="1" xmlns="http://xspf.org/ns/0/"> in order to interct with the media player we're using but i don't seem to be able to find a way to change the XML declaration other than to use: $doc = new DOMDocument('1', 'xmlns="http://xspf.org/ns/0/"') when newing a DOMdocument. but this only changes the attributes and not the actual node type, so its still returning <?xml version="1.0"?> I'm considering using file IO with regex's to get round the problem, but this is a bit of a dirty hack really. Can I manipulate the XML Declaration of a DOMDocument so that it reads '<playlist' rather than '<?xml' or remove the declaration altogether? I can't seem to find a way.
  4. thanks for getting back to me. that sorted it. cheers wildteen88!
  5. Hi there, I'm new to the PHP Freaks forum, but i thought i'd give it a shot to see if anybody here knows the answer or has any suggestions. I'm trying to pass post data between forms - here is the receiving form. <?php $companyName = $_POST["companyName"]; $information = $_POST["information"]; $testimonial = $_POST["testimonial"]; $weburl = $_POST["weburl"]; $localaddress = $_POST["localaddress"]; $username = $_POST["username"]; $password = $_POST["password"]; $public = $_POST["public"]; $username = $_POST["username"]; /** * * * @version $Id$ * @copyright 2008 */ ?> <html><head></head><body><p><?php echo $companyName; ?></p> <p><?php echo $information; ?></p> <p><?php echo $testimonial; ?></p> <p><?php echo $weburl; ?></p> <p><?php echo $localaddress; ?></p> <p><?php echo $username; ?></p></body></html> <?php ?> This form and the sending form works on our public web server but for some reason if i try and process the form locally using WAMP the output is returning:- <html><head></head><body><p><? echo $companyName; ?></p> <p><? echo $information; ?></p> <p><? echo $testimonial; ?></p> <p><? echo $weburl; ?></p> <p><? echo $localaddress; ?></p> <p><? echo $username; ?></p></body></html> Instead of the actual data contained within those variables. I'm really in the dark as to why this is happening. Is it something to do with the way php is processing the form?
×
×
  • 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.