

P.S
Chyba że zna ktoś inne rozwiązanie z odtwarzaczem muzycznym we fleshu

<?xml version="1.0" encoding="ISO-8859-2"?> <lista> <nagranie> <file>nagranie.mp3</file> </nagranie> </lista>
<?xml version="1.0" encoding="ISO-8859-2"?> <lista> <file src="nagranie.mp3" /> </lista>
<?php $xml = new DomDocument( '1.0', 'ISO-8859-2' ); // Tworzymy ngłówny element $node = $xml->appendChild( $xml->createElement( 'node' ) ); // Tworzymy element-dziecko $subnode = $node->appendChild( $xml->createElement( 'subnode' ) ); // Przypisujemy elementowi atrybut: attribute="value" $subnode->setAttribute( 'attribute', 'value' ); ?>
<?xml version="1.0" encoding="ISO-8859-2"?> <playlista> <file>nagranie.mp3</file> </playlista>
<file src="nagranie.mp3" />
<?php } $xml = new DomDocument('1.0', 'ISO-8859-2'); $tabela = $xml->appendChild($xml->createElement('playlist')); foreach ($dane as $pole=>$wartosc) { $element = $tabela->appendChild($xml->createElement($pole)); $element->appendChild($xml->createTextNode($wartosc)); } } $xml->formatOutput = true; $xml->save("lista.xml"); ?>
<?php $element->setAttribute( 'src', "$wartosc"); ?>
<?xml version="1.0" encoding="ISO-8859-2"?> <playlist> <id src="1"/> <file src="1.mp3"/> <id src="2"/> <file src="2.mp3"/> </playlist>
<?xml version="1.0" encoding="ISO-8859-2"?> <playlist> <file src="1.mp3"/> <file src="2.mp3"/> </playlist>
<?php } $xml = new DomDocument('1.0', 'ISO-8859-2'); $tabela = $xml->appendChild($xml->createElement('playlist')); foreach ($dane as $pole=>$wartosc) { if($pole=='id') {break;} //to dodać $element = $tabela->appendChild($xml->createElement($pole)); $element->appendChild($xml->createTextNode($wartosc)); } } $xml->formatOutput = true; $xml->save("lista.xml"); ?>
<?xml version="1.0" encoding="ISO-8859-2"?> <playlist/>
-- -- Struktura tabeli dla `odtwarzacz` -- CREATE TABLE `odtwarzacz` ( `id` int(11) NOT NULL, `file` varchar(500) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin2; -- -- Zrzut danych tabeli `odtwarzacz` -- INSERT INTO `odtwarzacz` (`id`, `file`) VALUES (1, '1.mp3'), (2, '2.mp3');
<?php } $xml = new DomDocument('1.0', 'ISO-8859-2'); $tabela = $xml->appendChild($xml->createElement('playlist')); foreach ($dane as $pole=>$wartosc) { if($pole=='id') {break 1;} //to dodać $element = $tabela->appendChild($xml->createElement($pole)); $element->appendChild($xml->createTextNode($wartosc)); } } $xml->formatOutput = true; $xml->save("lista.xml"); ?>
SELECT file FROM odtwarzacz
<?php $element = $tabela->appendChild( $xml->createElement( 'file' ) ); $element->setAttribute( 'src', $dane['file'] ); ?>