Hi,
I need help getting a loop to run appropriately inside another loop.. or what the best way to arrange this is.
What I want is:
a. big main album thumb + the first 4 album thumbs small, (these all link you to the first image)
b. then repeat for each following album.
Need help with:
1. The page I've made (richardpierpetit.com/index.php) looks the way I want from using css overrides (except for the error on the bottom), but I'm sure there's a more optimal approach.
a. My attempt to pull the image thumbs inside the main album thumb loop is causing the error, but I don't know what to change to get it to run smoothly.
2. Further, I'd like to only display the first 4 thumbs in the gallery, but the current php code displays all the thumbs due to this line.. "php while next image (false, firstpageimages)" but if I change firstpageimages to a number such as 4, i get the first 4 thumbs for gallery 1, then 2 thumbs for each following gallery.. the array number doesnt reset.
3. I'd like to change the anchor link for all the thumbs to just point to the 1st photo of each album
--Thanks so much for any help!
The code I used is below:
`
<?php
$counter = 0;
while (next_album()):
?>
<?php while (next_image(false, $firstPageImages)): ?>
<?php endwhile; ?>
<?php
if ($counter == 2) {
echo "</ul>
";
}
$counter++;
endwhile;
?>
<?php printPageListWithNav("� ".gettext("prev"), gettext("next")." �"); ?>
`
Comments
1a. Don'T know what cause the error. What function do you have at the end of the page?
3. You have some work to do:
`
$images = $_zp_current_album->getImages();
$firstimage = $images[0];
$imageobj = newImage($_zp_current_album,$firstimage);
$firstimageurl = $imageobj->getImageLink();
`
1a. fixed: I took out a previous/next navigation print link and it executes the whole script now.
3. I inserted that above while next image but it didnt seem to do the trick.
What did I do wrong?
thank you!
`
<?php
$counter = 0;
while (next_album()):
?>
<?php $images = $_zp_current_album->getImages();
$firstimage = $images[0];
$imageobj = newImage($_zp_current_album,$firstimage);
$firstimageurl = $imageobj->getImageLink(); ?>
<?php while (next_image()): ?>
<?php endwhile; ?>
<?php
if ($counter == 2) {
echo "</ul>
";
`}
$counter++;
endwhile;
?>
3. `$firstimageurl = $imageobj->getImageLink();` generates the url to the first image of the album in the loop. So you of course need to insert that url to the tag, too....
I just posted at the website link of what it looks like when I use false, 4. It works for the 1st 4, but after that not so much.. =/
for the image thumb div links, i tried replacing a href=`echo htmlspecialchars(getImageLinkURL()); ` with getImageLink and that gave an error. Did I put it in the wrong place?
I've made the following modifications to index.php at (roughly) line 26:
`" title="<?php echo gettext('View album:'); ?> <?php echo getAnnotatedAlbumTitle();?>"><?php printAlbumThumbImage(getAnnotatedAlbumTitle()); ?><?php while (next_image(false, 2)): ?><?php printImageThumb(getAnnotatedAlbumTitle()); ?><?php endwhile; ?>`
This is within the next_album() while loop. The goal here is to have the first two images in any album display along side the main album thumb.
The issue I'm having occurs when the next_album() loop continues to subsequent albums - the next_image loop, instead of showing the first 2 images, shows all the images of the album beginning with image number 3 and loops to the end of the album.
Is there some way the next_album() loop can be 'tricked' into thinking that it's always being run for the very first time?
Thanks,
-Dave.
using your advice and the following post as a guide:
http://www.zenphoto.org/support/topic.php?id=5486#post-31848
I was able to come up with this located within the next_album loop:
`
<?php
$images = $_zp_current_album->getImages();
$firstimage = newImage($_zp_current_album,array_shift($images));
$thumb = $firstimage->getThumb();
?>
" />
`
A very nice little work around - thanks again for the advice. Now all I need to do is style it! ;p
-Dave.