Member
Member
joshrodgers   21-08-2012, 20:24
#1

I created a search page that searches for images throughout Zenphoto...everything works great except for one thing:

In my while I am trying to display which album an image is from...example: searching for "Blue" might return a picture of a crayon, underneath the picture it would read "Album: School Supplies".

My while is next_image, which is why my current code isn't working: echo getAlbumTitle()...I'm thinking because it needs to be in next_album while instead, but you cannot put a while inside a while (or at least I don't know how to)...so I'm stuck.

Any ideas?
Thanks,
Josh

Administrator
Administrator
acrylian   21-08-2012, 20:26
#2

You have to use the object model, specifially the album class. Please see the tutorial.

Member
Member
joshrodgers   21-08-2012, 20:58
#3

acrylian,

I looked through the tutorial, but I'm not sure how to use the global variables...I tried which states that it returns the album title, but it didn't work

Thanks,
Josh

Administrator
Administrator
acrylian   21-08-2012, 22:52
#4

Sorry, you have to first get the album object of the current image in the loop via the image class and then you have to use the album class. Within search the current album is only set within the next_album loop.

Member
Member
joshrodgers   21-08-2012, 23:23
#5

acrylian,

Sorry man, just not sure what to do here...I tried:

Member
Member
sbillard   22-08-2012, 00:13
#6

Guess you will have to learn. For starters look at the constructors for the album and image objects. They require parameters quite different from what you have placed in your code above.

$albumobject = $_zp_current_image->album; will get you the album object for the current image. If you are going to instantiate an image you need to use the newImage() function unless you know for sure what "kind" of image it is.

Sorry, but if you are going to step into the world of customizing your Zenphoto gallery there is no shortcut to learning about its structure and object model.

Member
Member
joshrodgers   22-08-2012, 15:48
#7

sbillard,

Ok...so, I went and looked at the newImage() function and ended up with: ``. Now, the album name is showing-up correctly...yay!!!

Thank you acrylian and sbillard!!!

Josh

Administrator
Administrator
acrylian   22-08-2012, 16:01
#8

Yep, that's it. echo $imageobject = $albumobject->getTitle(); is too much, just echo $albumobject->getTitle(); is enough.

Member
Member
joshrodgers   22-08-2012, 16:13
#9

acrylian,

Cool, made the change...works like a champ!!

Thanks again!!
Josh

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