Member
Member
beatricewebb   2010-09-14, 13:54
#1
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()): ?>

<div class="albumthumb"><a>"

title="<?php echo getAlbumTitle();?>">

<?php printAlbumThumbImage(getAlbumTitle()); ?></a>



<a>"

title="<?php echo getAlbumTitle();?>"></a>

<?php printAlbumTitle(true); ?> </div> <?php endwhile; ?>`

How do I modify this code to capture and list the albums and subalbums as well?
Administrator
Administrator
acrylian   2010-09-14, 14:06
#2
You will have to use the object model and create subloops within that loop. Please see the tutorial on the user guide.
Member
Member
beatricewebb   2010-09-15, 10:45
#3
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();

$count = count($allalbums);

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

{

$thisalbum = $allalbums[$i];

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

makeAlbumCurrent($albumobject);

echo getBareAlbumTitle() ;

}

?>

`
Administrator
Administrator
acrylian   2010-09-15, 10:57
#4
If you want just a nested list of the names you could also use the print_album_menu plugin.
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.