![]() |
|
Loop through Parent-Album on Sub-Album Page - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: General support (https://forum.zenphoto.org/forum-4.html) +--- Thread: Loop through Parent-Album on Sub-Album Page (/thread-8895.html) |
Loop through Parent-Album on Sub-Album Page - zubizuri - 2011-07-22 Hey guys, I was wondering how to create a loop through the Parent-Album (UrAlbum) when i am viewing a sub-album page. currently my loop looks like: <?php while (next_image(true, $firstPageImages)): do stuff; endwhile; ?> Is there any way to tell the loop function to check the parent album instead of the current sub-album? Loop through Parent-Album on Sub-Album Page - acrylian - 2011-07-22 No, you have to use the object model. See the tutorial and the functions documenation. Btw, the parent album is not necessarily the uralbum. The latter refers to the top level parent. Loop through Parent-Album on Sub-Album Page - zubizuri - 2011-07-22 Well in my case the parent album is also the top level parent. I already used: $uralbumobj = getUrAlbum($_zp_current_album); To Show Custom Album Fields from my UrAlbum. Is there no simple way to connect the loop the the "$uralbumobj" Object as well? Loop through Parent-Album on Sub-Album Page - acrylian - 2011-07-22 You could set the uralbum object to the current album object. But that might of course confuse other parts of your site. Then you should use the object model directly. Loop through Parent-Album on Sub-Album Page - zubizuri - 2011-07-29 For those who are searching the forum for the same question, this is how i did it: Make a copy of the "next_image" function, name it "nextUr_image". Put this function into the template "functions.php", add this line on top : `$_zp_parent_album = getUrAlbum($_zp_current_album);` and replaced all "$_zp_current_album" in the function with "$_zp_parent_album". Now you can write your loop on the album.php page like this: ` while (nextUr_image()): ` And you will have a query through your Top-Level Parent Album, while you're on a sub-album page. Loop through Parent-Album on Sub-Album Page - zubizuri - 2011-07-29 btw. thanks for your support acrylian. Loop through Parent-Album on Sub-Album Page - acrylian - 2011-07-29 You are welcome. You could have used the object model directly as well. |