Member
Member
risottto   27-08-2012, 19:02
#1

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

Member
Member
sbillard   27-08-2012, 19:19
#2

So, some quick questions for you. What is the function result of the album method getAlbums()? And what is the first parameter of that functions's use?

You are almost on the right track. But you do need a little bit better research.

Member
Member
risottto   27-08-2012, 19:48
#3

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.

Member
Member
sbillard   27-08-2012, 21:23
#4

Do you get any errors? They might be a clue as to the problem.

What type of varible do you think $imgalb should be? What type is is?

Member
Member
risottto   27-08-2012, 22:15
#5

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

Member
Member
sbillard   27-08-2012, 22:21
#6

So then from the error one would presume that strings are not objects so they do not have methods such as getImages()

Member
Member
risottto   27-08-2012, 22:38
#7

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?

Member
Member
sbillard   27-08-2012, 22:57
#8

Perhaps you should review the PHP object model a little.

You should be instantiating an album object via the new Album() syntax.

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.