PHP For my XML Feed

Discussion in 'PHP' started by DebbieJ, Mar 3, 2012.

  1. #1
    Hi there,

    I am a affiliate for a garden store and they have given me this feed to work with;
    http://www.liveoutside.co.uk/plugins/system/vmrss/all_products.xml
    I want to display the following from the feed;
    All gazeboes, their title with link to store, description, image and price.
    I want to display them in a table, 2 on every row.

    I have tried using magpie to parse the information, I have this code on my site;

    <?PHP

    require_once 'rss_fetch.inc';

    $url = 'http://www.liveoutside.co.uk/plugins/system/vmrss/all_products.xml';
    $rss = fetch_rss($url);

    echo "Site: ", $rss->channel['title'], "<br>\n";
    echo "Feed URL: <a href='", $url ,"'>", $url, "</a><br>\n";
    foreach ($rss->items as $item ) {
    $title = $item[title];
    $url = $item[link];
    echo "<a href=$url>$title</a></li><br>\n";


    }

    ?>

    This code works and it displays the feed but I don't know how to extract the elements that I want and put them into a table format.

    I am new to php, can anybody tell me how I can do this please?
     
    DebbieJ, Mar 3, 2012 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    check out php.net/print_r to display the content of $rss :)
     
    EricBruggema, Mar 4, 2012 IP
  3. HiTEC

    HiTEC Well-Known Member

    Messages:
    92
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    123
    #3
    As i saw in the xml Gazebos is the category of items u want to display only. Then u need to exclude all others from displaying in the foreach (the feed) for starters!

    And then u can customize the foreach loop to display inside or outside of an html as u want to display in table or any other way...
     
    HiTEC, Mar 4, 2012 IP