Album Description in Subalbum

Connie Member
Hi!
I am starting a new structure:

Festival 2008
|- 1st day
|-- group 1
|-- group 2
|-- group 3
|- 2nd day

The subalbum "1st day" shows all bands, there I want to show only (Sub-)AlbumName and CustomData

in the subalbum "1st day/group 1" I want to show (Sub-)AlbumName + (Sub-)AlbumDescription

but as I understand, the album.php does not differ between Album and Subalbum...

is there a chance to add this in some way to the default-theme / album.php?

I cannot show any URL as I customize locally, but I use the latest build 1954...

Comments

  • acrylian Administrator, Developer
    Yes, it is..:-) Place something like this within the `next_album()` loop:

    `<?php $subalbums = $_zp_current_album->getSubalbums();

    foreach ($subalbums as $subalbum) {

    $album = new Album($_zp_gallery, $subalbum);

    echo $album->getTitle();

    echo $album->getDesc();

    }

    ?>`
    This prints the direct subalbums of the current album with title and description. You find all info what else you can use with the album object here: http://www.zenphoto.org/documentation/zenphoto/Album.html. Also you could look at the function printAlbumStatisticItem() of the image_album_statistics plugin for a direct example.
  • Connie Member
    Either I didn't get it or you didn't understand me:

    Album 1 has 5 subalbums, so:

    Album 1 should list Title and Custom-Data of each subalbum,

    the subalbum then should print album title + album description

    in http://www.jazzbuero-hamburg.de/diesunddas/zen/index.php?album=jazzopen-hamburg-2008
    I just want to have the thumb, the title and the custom-data,

    in
    http://www.jazzbuero-hamburg.de/diesunddas/zen/index.php?album=jazzopen-hamburg-2008/NDRjpg

    I want title, descriptions and images,

    let's name it like this:
    - album has subalbum: print thumb + title + album-custom data

    - album has no subalbum (last in the chain): print title + description + images

    so I do not know how to do that
  • If I understand correctly you want what is displayed to be based somehow on the album (maybe its level in the hierarchy, its name or its contents.)

    To do this you would need to establish the type of album in code before the next_album() loop and then in the loop, based on this determination, execute the appropriate code.

    So, if what you want is based on the album being a root album (Album 1) the test would be: `$rootalbum = is_null($_zp_current_album->getParent())'` and you would have in your loop: `if ($rootablum) { print thumb + title + album-custom data } else { print title + description + images }`

    Testing for subalbums is as follows: `$hassubalbums = count($_zp_current_album->getSubalbums() > 0);`
  • Connie Member
    yeah, the last example gets it!

    If ($hassubalbums == 0) print album descripton
    else
    print custom album data

    Now I have orientation, thanks a lot!
  • acrylian Administrator, Developer
    Ok, I indeed got you wrong then..:-)
  • Connie Member
    No problem, I got it! ;=)
    `

    <?php $hassubalbums = count($_zp_current_album->getSubalbums() > 0);

    if ($hassubalbums == 1) echo getAlbumCustomData();

    else print printAlbumDesc(); ?>

    `
  • http://www.zenphoto.org/documentation/zenphoto/Album.html >>> takes me to the testimonial page, not information about the topic :( Have had this problem with other URLs you've quoted.
  • acrylian Administrator, Developer
    Strange, I get to the right page...
  • Technically all you need is
    `

    <?php $hassubalbums = count($_zp_current_album->getSubalbums() > 0);

    if ($hassubalbums) echo getAlbumCustomData();

    else print printAlbumDesc(); ?>

    ` but your code will work as well.
  • Connie Member
    yes,

    `($hassubalbums == 1)` is the same as `($hassubalbums)`
    you are right, sometimes I am a little redundant ;=)
  • Your URL took me to Testimonials, plus it's possible to period as sentance end interffered. My URL worked okay. Will see next time what happens.
  • acrylian Administrator, Developer
    @macalter, yep there got a period inbetween my link above.
Sign In or Register to comment.