Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Images in atom_content array

brennen
2005-08-19
2013-04-30
  • brennen
    brennen
    2005-08-19

    I'm using Magpie to to pull an Atom 1.0 feed generated from Textpattern.

    Here's the page: http://www.pnca.edu/test2.php

    Notice how the second entry, which doesn't have an image associated with it, pull the same image as the first entry? Does anyone have any ideas how I can check to make sure it only associates an image with the correct post?

    This only happens when run through Magpie. The Textpattern output is fine.

    Here's the code I'm currently using, with a print_r to see the full returned arrays:

    <?php
    define('MAGPIE_OUTPUT_ENCODING', 'UTF-8');
    define('MAGPIE_CACHE_DIR', '/tmp/magpie_cache');
    require_once "includes/magpierss/rss_fetch.inc";
    $atom = fetch_rss("http://www.pnca.edu/exposure/?atom=1&category=home");
    $maxitems = 3;
    $items = array_slice($atom->items, 0, $maxitems);               
    print_r($items);

    foreach ($items as $item) {

    print '<h3><a href="'.$item['link'].'">'.$item['title'].'</a></h3>';
    if ($item['atom_content'] != '') {
        print $item['atom_content'];
    } else {
        print $item['summary'];
        }
    }
    ?>

    Thanks for any help!