Just when I think I have been able to figure out almost everything on how to customize Zenphoto, I just cam across a tough nut to crack.
I have a colorbox slideshow activated using the PrintSlideShowLink() on my image, album, and search results pages. Works great with one exception: when I am in an album that contains sub-albums but no images there is no link. I would like the slideshow link to start a slideshow with the first image in the first (sub)-album.
My best idea so far is to use a custom version of the PrintSlideShowLink() (copied and pasted into the theme's functions.php). I figured out that the slideshow link creates a series of hidden divs with links to images to start the slideshow. In the PrintSlideShowLink() function I think there should be a way to modify the code that pulls the array of images to make the divs:
if($numberofimages > 0) { if ((in_context(ZP_SEARCH_LINKED) && !in_context(ZP_ALBUM_LINKED)) || in_context(ZP_SEARCH) && is_null($_zp_current_album)) { $images = $_zp_current_search->getImages(0); } else { $images = $_zp_current_album->getImages(0);
So that the $images array can be generated from the first sub-album of the current album if there are no images present. I tried:
$album1 = $_zp_current_album->getAlbums(1); $images = $album1->getImages(0);
Not working though, is there a better ZenPhoto Command to pull an images array from the first sub-album in an album?
Thanks in advance
on ZenPhoto 1.4.3.1
the result from GetAlbums() (using print_r) is:
Array ( [0] => album/subalbum1 [1] => album/subalbum2 [2] => album/subalbum3 [3] ...)
The first Parameter I used was 0 which was described in the documentation as:
"string $page: Which page of subalbums to display."
I got the code below to return the name of the first album:
$album1 = $_zp_current_album->getAlbums(0); $imgalb = reset($album1);
but still can't get $images =$imgalb->getImages(0); to return the image array from that album.
I have$imgalb as a string representing the first album of which I want to use the getImages() function on in 'PrintSlideShowLink()': $images = $imgalb->getImages(0);
I just get the error:
Call to a member function getImages() on a non-object in /Users/studiodlinc/Sites/dl2012/themes/dl_zenpage/album.php
Yes, now that makes sense, so I need I retrieve the equivalent of the $_zp_current_album variable based on the name of the first sub-album. Tried getAlbumArray but it gives you the folder structure, not the the object. Is there a ZenPhoto function that can do this?