views:

140

answers:

1

Referring to this question: http://stackoverflow.com/questions/2561475/flickr-phpflickr-api

how would you display a primary photo from a photoset rather than all photos and photosets?

this is the code I have so far:

<?php require_once("phpFlickr/phpFlickr.php");
$f = new phpFlickr("[APIKEY]");
$user = "xxxxxxxx@xxx";
$count = 1;
$photosets = $f->photosets_getList($user); ?>


<?php foreach ($photosets['photoset'] as $ph_set): ?>
<?php $parentID = $ph_set['parent']; ?>

 <?php $photoset_id = $ph_set['id'];
 $photos = $f->photosets_getPhotos($photoset_id);
     foreach ($photos['photoset']['photo'] as $photo): ?>

         <?php if($parentID == $ph_set['parent']): ?>
         <a rel="lightbox[album<?=$count;?>]" href="<?= $f->buildPhotoURL($photo,    'medium') ?>" title="<?= $photo['title'] ?>">
     <?php endif;?>

     <img src="<?= $f->buildPhotoURL($photo, 'square') ?>" alt="<?= $photo['title'] ?>" width="75" height="75" title="<?= $photo['title'] ?>" />
         <h3><?=$ph_set['title']?></h3>

     <?php if($parentID == $ph_set['parent']): ?>
             </a>

    <?php endif;?>
 <?php endforeach; ?>

all the photos display from every photoset, and when clicked on, Lightbox brings you through the whole photoset. that's fine, but would like to have all the thumbnails shown simply be 1 primary photo from each photoset. thanks!

A: 
<?php require_once("phpFlickr.php");
$f = new phpFlickr("[5218b8c93759bcd3797048772fd8e461]");
$user = "43569193@N08";
$count = 1;
$photosets = $f->photosets_getList($user); ?>


<?php foreach ($photosets['photoset'] as $ph_set): ?> //line20
<?php $parentID = $ph_set['parent']; ?>

Warning: Invalid argument supplied for foreach() in /home/n/naikomru/public_html/x/sidebar.php on line 20

why?