<?php $str = <<<XML <?xml version="1.0" encoding="UTF-8" ?> <root> <ARTICLEDATA> <ARTICLE> <A_PRICEDATA> <A_PRICE channel="1" currency="EUR"> <A_VK>34.95</A_VK> </A_PRICE> </A_PRICEDATA> <A_MEDIADATA> <A_MEDIA type="image" origname="9990.jpg">https://1.jpg</A_MEDIA> <A_MEDIA type="image" origname="11260.jpg">https://2.jpg</A_MEDIA> <A_MEDIA type="image" origname="12294.jpg">https://3.jpg</A_MEDIA> <A_MEDIA type="image" origname="13306.jpg">https://4.jpg</A_MEDIA> <A_MEDIA type="image" origname="13012.jpg">https://5.jpg</A_MEDIA> <A_MEDIA type="image" origname="13760.jpg">https://6.jpg</A_MEDIA> </A_MEDIADATA> </ARTICLE> <ARTICLE> <A_PRICEDATA> <A_PRICE channel="1" currency="EUR"> <A_VK>19.95</A_VK> </A_PRICE> </A_PRICEDATA> <A_MEDIADATA> <A_MEDIA type="image" origname="9990.jpg">https://10.jpg</A_MEDIA> <A_MEDIA type="image" origname="11260.jpg">https://2.jpg</A_MEDIA> <A_MEDIA type="image" origname="12294.jpg">https://3.jpg</A_MEDIA> <A_MEDIA type="image" origname="13306.jpg">https://4.jpg</A_MEDIA> <A_MEDIA type="image" origname="13012.jpg">https://5.jpg</A_MEDIA> <A_MEDIA type="image" origname="13760.jpg">https://6.jpg</A_MEDIA> </A_MEDIADATA> </ARTICLE> </ARTICLEDATA> </root> XML; $xml = simplexml_load_string($str); $articles = ""; foreach ($xml->ARTICLEDATA->ARTICLE as $article) { $price = (string)$article->A_PRICEDATA->A_PRICE->A_VK; $firstImage = (string)$article->A_MEDIADATA->A_MEDIA[0]; $produkt = "Product 1"; $articles .= '<div class="photo"><img src="' . $firstImage . '" style="width: 120px margin:5px;"><div class="product-info mt__15"><h3 class="product-title pr fs__14 mg__0 fwm">' . $produkt . '</h3><span class="price">€' . $price . ' EUR</span></div></div>'; } echo $articles;
You have javascript disabled. You will not be able to edit any code.