Display all albums and subalbums

My gallery has several albums some of them contain
subalbums. I want to list on a single page all my albums and subalbums if they contain any. Please can someone advise me on the code I need to do this.

Using the "album loop" I can list my albums:

`<?php while (next_album()): ?> <?php endwhile; ?>`

How do I modify this code to capture and list the albums and subalbums as well?

Comments

  • acrylian Administrator, Developer
    You will have to use the object model and create subloops within that loop. Please see the tutorial on the user guide.
  • By placing the following for loop inside the 'album loop', I have been able to list the album titles of all the subalbums contained in my albums:

    ` <?php $allalbums = getAllAlbums();<br />
    $count = count($allalbums);

    for ($i = 0; $i < $count; $i++)

    {

    $thisalbum = $allalbums[$i];

    $albumobject = new Album($_zp_gallery,$thisalbum);

    makeAlbumCurrent($albumobject);

    echo getBareAlbumTitle() ;

    }

    ?>

    `
  • acrylian Administrator, Developer
    If you want just a nested list of the names you could also use the print_album_menu plugin.
Sign In or Register to comment.