Hi,
I'm in the process of cobbling together quite a custom Zenphoto theme for my website. The way it functions isn't quite like your traditional gallery in that there's no need or place for navigation crumbs.
Because of this, when viewing an image, a link back up to the containing album is required. Along comes getAlbumLinkURL().
`
"
title="<?php echo getAlbumTitle(); ?>"><?php echo getAlbumTitle(); ?>`
This was working just as you'd expect until I added in a sub album and started testing and designing for those.
The problem I'm having is that when I have an album with both images and sub albums in it, for some reason the images always start on page 2.
On the album page I'm using the following, so it gets round the issue by specifying that 12 image thumbnails are allowed to share the first page with sub albums:
`
<?php while (next_image(false, 12)): ?>
`
The problem is that getAlbumLinkURL() still links to the 2nd page of the gallery for images that are seen as being on the first. I realise that getAlbumLinkURL() on image.php is not going to know about the fact I've specified I want image thumbs on the first page, so what I want to know is why does including sub albums suddenly make the rest of the images start on page 2? I'm guessing there's something I'm missing here but with my very limited PHP experience I can't work out what.
My current work around is just to omit the getAlbumLinkURL() and just link to "." as it's better ending up on the first page at least. Of course, it would be nice to restore the functionality where clicking the link brings you to the album page the image is on.
Sorry for the long post but I felt if I explain everything in detail it'll avoid me having to clarify later on.
Comments
But your real problem lies in the sharing of image thumbs and thumbs of sub albums. We have a function that "equals" the look if both appear together. Please search the documentation for "normalizColumns".
Example: I go to page 1 of an album, eg http://domain.tld/new-album-1. I click on an image thumbnail. On the image.php page my getAlbumLinkURL() links to http://domain.tld/new-album-1/page/2 instead, even though the image is not on page 2.
If I remove the 12 in next_image(false, 12) in the album.php, page 1 only has the sub albums on it, the images then start on page 2. This then matches with what getAlbumLinkURL() is doing.
So, the ,12 seems to make a "pretend" page 1 for the images. The gallery system still thinks the images start on page 2. I need to correct whatever the underlying reason is for the images starting on page 2.
Unfortunately due to the layout, normalizeColumns() is not any use to me, but thanks for the suggestion!
`
bool $all: set to true disable pagination
int $firstPageCount: the number of images which can go on the page that transitions between albums and images
`
So you actually want to use `next_image(true)` to show all images on one page and the 2nd parameter is not even needed at all.
Since you also have albums, you of course have to set the same for the `next_album()` loop for the albums as well.
Not knowing your theme at all I referred to `normalizeColumns()` as that often leads to pagination confusion if not used correctly.
Here's the album view, page 1:
http://parkside.rguk.eu/s/untitled1.jpg
And here's page 2:
http://parkside.rguk.eu/s/untitled3.jpg
Here's the image view:
http://parkside.rguk.eu/s/untitled2.jpg
The red circle shows my link back to the album.
The above is how I'm wanting it to display. The problem is that the link which I've circled in the image view goes to page 2. This only happens if I have sub albums.
I hope that this is clearer!
Cheers
`
<?php
$firstPageImages = getOption('images_per_page');
$_zp_conf_vars['images_first_page'] = getOption('images_per_page');
?>
`
Oh well, seems a little obvious to me now, but it wasn't before and examining normalizeColumns helped.
Thanks for your input!
`
<?php
if (getNumImages() > getOption('images_per_page')) {
$_zp_conf_vars['images_first_page'] = getOption('images_per_page');
$firstPageImages = getOption('images_per_page');
}
?>
`
<?php
if (getNumImages() > getOption('images_per_page')) {
$_zp_conf_vars['images_first_page'] = getOption('images_per_page');
$firstPageImages = getOption('images_per_page');
} else {
$_zp_conf_vars['images_first_page'] = getNumImages();
$firstPageImages = getNumImages();
}
?>
`
`
<?php
$numsubs = $_zp_current_album->getNumAlbums();
if ($numsubs !== 0) {
if (getNumImages() > getOption('images_per_page')) {
$_zp_conf_vars['images_first_page'] = getOption('images_per_page');
$firstPageImages = getOption('images_per_page');
} else {
$_zp_conf_vars['images_first_page'] = getNumImages();
$firstPageImages = getNumImages();
}
}
?>
`
This is what I have in the search.php for archive mode:
`
<?php
if (!isArchive()) {
if (getNumImages() > getOption('images_per_page')) {
$_zp_conf_vars['images_first_page'] = getOption('images_per_page');
$firstPageImages = getOption('images_per_page');
} else {
$_zp_conf_vars['images_first_page'] = getNumImages();
$firstPageImages = getNumImages();
}
}
?>
`
Cheers!