Heisann, sitter her og sliter med XML.
Her er XML delen jeg skal ha ut.
Og her er php scriptet
Det jeg ønsker å få til er å printe ut alle HEX kodene, men jeg får bare til å printe ut nr1 av dem, altså 69D2E7.
Noen som kan hjelpe meg?
Her er XML delen jeg skal ha ut.
Kode
<name> <colors> <hex>69D2E7</hex> <hex>A7DBD8</hex> <hex>E0E4CC</hex> <hex>F38630</hex> <hex>FA6900</hex> </colors> </name> <name> <colors> <hex>69D2E7</hex> <hex>A7DBD8</hex> <hex>E0E4CC</hex> <hex>F38630</hex> <hex>FA6900</hex> </colors> </name> <name> <colors> <hex>69D2E7</hex> <hex>A7DBD8</hex> <hex>E0E4CC</hex> <hex>F38630</hex> <hex>FA6900</hex> </colors> </name> <name> <colors> <hex>69D2E7</hex> <hex>A7DBD8</hex> <hex>E0E4CC</hex> <hex>F38630</hex> <hex>FA6900</hex> </colors> </name>
Kode
<?php $xml = new SimpleXMLElement('name.xml', null, true); foreach($xml as $data){ echo <<<EOF <h1 style="color:red;">{$data->colors->hex}</h1> EOF; } ?>
Noen som kan hjelpe meg?