How to show (style) xml product feed into php

I would like to show the content of an xml file in a way that it shows the title, image, price and button with external link to the website.

Construction of the xml:

 <![CDATA[ here comes the title ]]>
 <![CDATA[ here you can find the description of the product. ]]>
 <![CDATA[ brand1 &gt; brand2 &gt; brand3 &gt; brand ]]>
 <![CDATA[ 35.10 EUR ]]>

This is the code I have so far:

  font-weight: bold;
  font-size: 24px;
  color: seagreen;
  font-weight: bold;
  font-size: 20px;
  color: #bbb;
    outline: none;
    border: none;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    background-color: red;
    border: 1px solid red;
    border-radius: 50px;
    padding: 10px 25px;
    line-height: 24px;
    margin-bottom: 9px;
    transition: 0.3s;
    cursor: pointer;
     .col-md-4 {
     position: relative;
     min-height: 1px;
     padding-left: 15px;
     padding-right: 15px;
     @media (min-width: 992px) {
     .col-md-4 {
     width: 33.33333333%;
     float: left;
 $xml_data =    simplexml_load_file("") or 
 die("Error: Object Creation failure");

 foreach ($xml_data->children() as $data)
     echo "<div class='col-md-4'>";
     echo "<div class='title'>";
     echo $data->title ."<br>";
     echo "</div>";
     echo "<div class='description'>";
     echo $data->description ."<br> ";
     echo "</div>";
     echo "<div class='link'>";
     echo "<a href='$data->link' target='_blank'>koop nu</a>";
     echo "</div>";
     echo "</div>";



but it gives me these issues:

1/ how to show the price and image: in the xml it is named “<g:price>” which is different than the other ones (no “g:”)

2/ how to exclude product types, like f.ex. I just want to show products of brand2

3/ how to not show entries that have no content

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.