Loop through Parent-Album on Sub-Album Page

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?

Comments

  • acrylian Administrator, Developer
    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.
  • 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?
  • acrylian Administrator, Developer
    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.
  • 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.
  • btw. thanks for your support acrylian.
  • acrylian Administrator, Developer
    You are welcome. You could have used the object model directly as well.
Sign In or Register to comment.